This repository has been archived by the owner on Apr 1, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6a8f71d
commit 9daf548
Showing
2 changed files
with
19 additions
and
15 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
if defined? Typhoeus | ||
Typhoeus.class_eval do | ||
def get_with_newrelic_trace(*args, &block) | ||
metrics = ["External/#{@address}/Typhoeus/#{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) | ||
require 'uri' | ||
module Typhoeus | ||
Request.instance_eval do | ||
def get_with_newrelic_trace(*args, &block) | ||
uri = URI.parse(args.first) | ||
metrics = ["External/#{uri.host}/Typhoeus/GET","External/#{uri.host}/all"] | ||
if NewRelic::Agent::Instrumentation::MetricFrame.recording_web_transaction? | ||
metrics << "External/allWeb" | ||
else | ||
metrics << "External/allOther" | ||
end | ||
self.class.trace_execution_scoped metrics do | ||
get_without_newrelic_trace(*args, &block) | ||
end | ||
end | ||
alias get_without_newrelic_trace get | ||
alias get get_with_newrelic_trace | ||
end | ||
alias get_without_newrelic_trace request | ||
alias get get_with_newrelic_trace | ||
end | ||
end | ||
end |
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