# File lib/rpm_contrib/instrumentation/picky.rb, line 32 def execute_with_newrelic_trace *args metrics = "Custom/Picky/search: #{Picky::NewRelic.obfuscate_tokens args[0]}" self.class.trace_execution_scoped(metrics){ execute_without_newrelic_trace(*args) } end
# File lib/rpm_contrib/instrumentation/typhoeus.rb, line 15 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
# File lib/rpm_contrib/instrumentation/curb.rb, line 15 def host self.url.respond_to?(:host) ? self.url.host : URI_CLASS.parse(self.url).host end
# File lib/rpm_contrib/instrumentation/mongo.rb, line 17 def instrument_with_newrelic_trace(name, payload = {}, &blk) payload = {} if payload.nil? collection = payload[:collection] if collection == '$cmd' f = payload[:selector].first name, collection = f if f end trace_execution_scoped("Database/#{collection}/#{name}") do t0 = Time.now res = instrument_without_newrelic_trace(name, payload, &blk) NewRelic::Agent.instance.transaction_sampler.notice_sql(payload.inspect, nil, (Time.now - t0).to_f) res end end
TODO: http, http_delete, http_get, http_post, http_head, http_put
# File lib/rpm_contrib/instrumentation/curb.rb, line 20 def perform_with_newrelic_trace(*args, &block) metrics = ["External/#{host}/Curl::Easy","External/#{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 perform_without_newrelic_trace(*args, &block) end end
# File lib/rpm_contrib/instrumentation/sinatra.rb, line 14 def render_with_newrelic_trace(*args, &block) engine, file = *args return render_without_newrelic_trace(*args, &block) if file == "= yield" file = "Proc" if file.is_a?(Proc) metrics = ["View/#{engine}/#{file}/Rendering"] self.class.trace_execution_scoped metrics do render_without_newrelic_trace(*args, &block) end end
# File lib/rpm_contrib/instrumentation/mongo.rb, line 44 def send_get_more_with_newrelic_trace trace_execution_scoped("Database/#{collection.name}/refresh") do send_get_more_without_newrelic_trace end end