module Gateway::Feature::NewRelic

Protected Instance Methods

record_newrelic() click to toggle source
# File lib/gateway/feature/new_relic.rb, line 16
def record_newrelic
  defined?(::NewRelic) && options.fetch(:record_newrelic, false)
end
with_new_relic(opts={}, &block) click to toggle source
# File lib/gateway/feature/new_relic.rb, line 6
def with_new_relic(opts={}, &block)
  return block.call unless opts.fetch(:record_newrelic, record_newrelic)

  # per newrelic support: ['External/servicename/all', 'External/allWeb']
  metric_names = ["External/#{name}/all", 'External/allWeb']
  ::NewRelic::Agent::MethodTracer.trace_execution_scoped metric_names do
    block.call
  end
end