Module: Datadog::Tracing::Contrib::ActionPack::ActionDispatch::Instrumentation

Defined in:
lib/datadog/tracing/contrib/action_pack/action_dispatch/instrumentation.rb

Overview

Instrumentation for ActionDispatch components

Defined Under Namespace

Modules: Journey

Class Method Summary collapse

Class Method Details

.dispatcher_route?(route) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
32
33
34
35
36
# File 'lib/datadog/tracing/contrib/action_pack/action_dispatch/instrumentation.rb', line 29

def dispatcher_route?(route)
  return true if route.dispatcher?

  # in Rails 4 there is no #rack_app method on the app
  return true if route.app.respond_to?(:rack_app) && !route.app.rack_app.nil?

  false
end

.set_http_route_tags(route_spec, script_name) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/datadog/tracing/contrib/action_pack/action_dispatch/instrumentation.rb', line 14

def set_http_route_tags(route_spec, script_name)
  return unless Tracing.enabled?

  return unless route_spec

  request_trace = Tracing.active_trace
  return unless request_trace

  request_trace.set_tag(Tracing::Metadata::Ext::HTTP::TAG_ROUTE, route_spec.to_s.gsub(/\(.:format\)\z/, ''))

  if script_name && !script_name.empty?
    request_trace.set_tag(Tracing::Metadata::Ext::HTTP::TAG_ROUTE_PATH, script_name)
  end
end