Created
June 11, 2014 16:54
-
-
Save benweint/b890052576e223c08e7a to your computer and use it in GitHub Desktop.
Using ControllerInstrumentation without a host class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'newrelic_rpm' | |
def do_something | |
puts 'working!' | |
sleep(3) | |
end | |
include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation | |
# | |
# These options are documented here: | |
# http://rubydoc.info/github/newrelic/rpm/NewRelic/Agent/Instrumentation/ControllerInstrumentation:perform_action_with_newrelic_trace | |
# | |
trace_options = { | |
:category => :task, | |
:class_name => 'MyClass', | |
:name => 'do_something' | |
} | |
100.times do | |
perform_action_with_newrelic_trace(trace_options) do | |
do_something | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment