module NewRelic::Agent::Instrumentation::Roda::Tracer

Constants

INSTRUMENTATION_NAME

Public Class Methods

included(clazz) click to toggle source
# File lib/new_relic/agent/instrumentation/roda/instrumentation.rb, line 12
def self.included(clazz)
  clazz.extend(self)
end

Public Instance Methods

_roda_handle_main_route_with_tracing(*args) { || ... } click to toggle source
# File lib/new_relic/agent/instrumentation/roda/instrumentation.rb, line 43
def _roda_handle_main_route_with_tracing(*args)
  NewRelic::Agent.record_instrumentation_invocation(INSTRUMENTATION_NAME)

  perform_action_with_newrelic_trace(
    category: :roda,
    name: ::NewRelic::Agent::Instrumentation::Roda::TransactionNamer.transaction_name(request),
    params: ::NewRelic::Agent::ParameterFiltering::apply_filters(request.env, rack_request_params)
  ) do
    yield
  end
end
build_rack_app_with_tracing() { || ... } click to toggle source
# File lib/new_relic/agent/instrumentation/roda/instrumentation.rb, line 24
def build_rack_app_with_tracing
  unless NewRelic::Agent.config[:disable_roda_auto_middleware]
    newrelic_middlewares.each do |middleware_class|
      self.use middleware_class
    end
  end
  yield
end
do_not_trace?() click to toggle source
# File lib/new_relic/agent/instrumentation/roda/instrumentation.rb, line 55
def do_not_trace?
  NewRelic::Agent::Instrumentation::Roda::Ignorer.should_ignore?(self, :routes)
end
ignore_apdex?() click to toggle source
# File lib/new_relic/agent/instrumentation/roda/instrumentation.rb, line 59
def ignore_apdex?
  NewRelic::Agent::Instrumentation::Roda::Ignorer.should_ignore?(self, :apdex)
end
ignore_enduser?() click to toggle source
# File lib/new_relic/agent/instrumentation/roda/instrumentation.rb, line 63
def ignore_enduser?
  NewRelic::Agent::Instrumentation::Roda::Ignorer.should_ignore?(self, :enduser)
end
newrelic_middlewares() click to toggle source
# File lib/new_relic/agent/instrumentation/roda/instrumentation.rb, line 16
def newrelic_middlewares
  middlewares = [NewRelic::Rack::BrowserMonitoring]
  if NewRelic::Rack::AgentHooks.needed?
    middlewares << NewRelic::Rack::AgentHooks
  end
  middlewares
end
rack_request_params() click to toggle source

Roda makes use of Rack, so we can get params from the request object

# File lib/new_relic/agent/instrumentation/roda/instrumentation.rb, line 34
def rack_request_params
  begin
    @_request.params
  rescue => e
    NewRelic::Agent.logger.debug('Failed to get params from Rack request.', e)
    NewRelic::EMPTY_HASH
  end
end