Skip to content

Instantly share code, notes, and snippets.

@fbjork
Created November 5, 2010 21:34
Show Gist options
  • Save fbjork/664913 to your computer and use it in GitHub Desktop.
Save fbjork/664913 to your computer and use it in GitHub Desktop.
if defined? EventMachine::HttpRequest
EventMachine::HttpRequest.instance_eval do
def request_with_newrelic_trace(*args, &block)
metrics = ["External/#{@req.uri}/EventMachine::HttpRequest/#{args[0].method}","External/#{@address}/all"]
if NewRelic::Agent::Instrumentation::MetricFrame.recording_web_transaction?
metrics << "External/allWeb"
else
metrics << "External/allOther"
end
self.class.trace_execution_scoped metrics do
request_without_newrelic_trace(*args, &block)
end
end
alias request_without_newrelic_trace setup_request
alias setup_request request_with_newrelic_trace
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment