Skip to content

Instantly share code, notes, and snippets.

@swalberg
Created January 23, 2012 18:47
Show Gist options
  • Save swalberg/1664840 to your computer and use it in GitHub Desktop.
Save swalberg/1664840 to your computer and use it in GitHub Desktop.
require 'stalker'
include Stalker
require 'newrelic_rpm'
NewRelic::Agent.manual_start :app_name => 'Wave Payroll', :agent_enabled => true
job 'email.new_user' do |args|
user = User.find(args["user_id"])
UserMailer.welcome_email(user).deliver
UserMailer.notify_admin(user).deliver
end
# Trace all the jobs as background tasks
# The :name is expanded at run time, hence single quotes
# See https://newrelic.com/docs/ruby/monitoring-ruby-background-processes-and-daemons
class << self
include NewRelic::Agent::Instrumentation::ControllerInstrumentation
add_transaction_tracer :job, :name => '#{args[0]}', :category => 'task'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment