class Object

Constants

RPM_CONTRIB_LIB
URI_CLASS

Public Instance Methods

execute_with_newrelic_trace(*args) click to toggle source
# 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
get(*args, &block) click to toggle source
Also aliased as: get_without_newrelic_trace
get_with_newrelic_trace(*args, &block) click to toggle source
# 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
Also aliased as: get
get_without_newrelic_trace(*args, &block) click to toggle source
Alias for: get
host() click to toggle source
# 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
instrument_with_newrelic_trace(name, payload = {}, &blk) click to toggle source
# 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
perform(*args, &block) click to toggle source
Also aliased as: perform_without_newrelic_trace, perform_without_newrelic_trace
perform_with_newrelic_trace(*args, &block) click to toggle source

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
Also aliased as: perform, perform
perform_without_newrelic_trace(*args, &block) click to toggle source
Alias for: perform
render(*args, &block) click to toggle source
render_with_newrelic_trace(*args, &block) click to toggle source
# 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
Also aliased as: render
render_without_newrelic_trace(*args, &block) click to toggle source
Alias for: render
send_get_more_with_newrelic_trace() click to toggle source
# 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