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

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

Overview

Instrumentation for ActionDispatch::Journey::Router for Rails versions older than 7.1

Instance Method Summary collapse

Instance Method Details

#find_routes(req) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/datadog/tracing/contrib/action_pack/action_dispatch/instrumentation.rb', line 42

def find_routes(req)
  result = super

  # result is an array of [match, parameters, route] tuples
  routes = result.map(&:last)

  routes.each do |route|
    if Instrumentation.dispatcher_route?(route)
      Instrumentation.set_http_route_tags(route.path.spec, req.env['SCRIPT_NAME'])
      break
    end
  end

  result
end