diff --git a/lib/rpm_contrib/instrumentation/typhoeus.rb b/lib/rpm_contrib/instrumentation/typhoeus.rb index 42ee889..509bd96 100644 --- a/lib/rpm_contrib/instrumentation/typhoeus.rb +++ b/lib/rpm_contrib/instrumentation/typhoeus.rb @@ -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 diff --git a/rpm_contrib.gemspec b/rpm_contrib.gemspec index 86ab1ca..6658a6c 100644 --- a/rpm_contrib.gemspec +++ b/rpm_contrib.gemspec @@ -37,6 +37,7 @@ the New Relic Ruby monitoring gem newrelic_rpm. "lib/rpm_contrib/instrumentation/paperclip.rb", "lib/rpm_contrib/instrumentation/redis.rb", "lib/rpm_contrib/instrumentation/resque.rb", + "lib/rpm_contrib/instrumentation/typhoeus.rb", "test/helper.rb", "test/schema.rb", "test/test_mongoid.rb", @@ -67,5 +68,4 @@ the New Relic Ruby monitoring gem newrelic_rpm. else s.add_dependency(%q, [">= 2.13.1"]) end -end - +end \ No newline at end of file