Skip to content

Commit d81bc52

Browse files
Merge branch 'main' into release/opentelemetry-resource-detector-aws
2 parents 2736597 + 75ba22b commit d81bc52

File tree

1 file changed

+4
-1
lines changed
  • instrumentation/action_pack/lib/opentelemetry/instrumentation/action_pack/handlers

1 file changed

+4
-1
lines changed

instrumentation/action_pack/lib/opentelemetry/instrumentation/action_pack/handlers/action_controller.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ def finish(_name, _id, payload)
5353
# @return [Array<String, Hash>] the span name and attributes
5454
def to_span_name_and_attributes(payload)
5555
request = payload[:request]
56-
http_route = request.route_uri_pattern.chomp('(.:format)') if request.respond_to?(:route_uri_pattern)
56+
# It seems that there are cases in Rails functional tests where it bypasses the routing system and the `action_dispatch.route_uri_pattern` header not being set.
57+
# Our Test suite executes the routing system so we are unable to recreate this error case.
58+
# https://github.com/rails/rails/blob/747f85f200e7bb2c1a31b4e26e5a5655e2dc0cdc/actionpack/lib/action_dispatch/http/request.rb#L160
59+
http_route = request.route_uri_pattern&.chomp('(.:format)') if request.respond_to?(:route_uri_pattern)
5760

5861
attributes = {
5962
OpenTelemetry::SemanticConventions::Trace::CODE_NAMESPACE => String(payload[:controller]),

0 commit comments

Comments
 (0)