-
-
Save lsylvester/5140591 to your computer and use it in GitHub Desktop.
This file contains 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
DependencyDetection.defer do | |
@name = :net | |
depends_on do | |
defined?(HTTPI) | |
end | |
executes do | |
NewRelic::Agent.logger.debug "Installing HTTPI instrumentation" | |
end | |
executes do | |
HTTPI.instance_eval do | |
def request_with_newrelic_trace(method, request, adapter, &block) | |
host = request.url.host | |
metrics = ["External/#{host}/HTTPI/#{method}", "External/#{host}/all", "External/all"] | |
if NewRelic::Agent::Instrumentation::MetricFrame.recording_web_transaction? | |
metrics << "External/allWeb" | |
else | |
metrics << "External/allOther" | |
end | |
trace_execution_scoped(metrics) do | |
request_without_newrelic_trace(method, request, adapter, &block) | |
end | |
end | |
alias request_without_newrelic_trace request | |
alias request request_with_newrelic_trace | |
end | |
end | |
end if defined? DependencyDetection |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment