File tree Expand file tree Collapse file tree 3 files changed +12
-18
lines changed
action_pack/lib/opentelemetry/instrumentation/action_pack
rack/lib/opentelemetry/instrumentation/rack/middlewares/stable Expand file tree Collapse file tree 3 files changed +12
-18
lines changed Original file line number Diff line number Diff line change @@ -15,22 +15,18 @@ class Railtie < ::Rails::Railtie
1515 stability_opt_in = ENV . fetch ( 'OTEL_SEMCONV_STABILITY_OPT_IN' , '' )
1616 values = stability_opt_in . split ( ',' ) . map ( &:strip )
1717
18- if values . include? ( 'http/dup' )
19- app . middleware . insert_before (
20- 0 ,
21- *OpenTelemetry ::Instrumentation ::Rack ::Instrumentation . instance . middleware_args_dup
22- )
18+ middleware_args = if values . include? ( 'http/dup' )
19+ OpenTelemetry ::Instrumentation ::Rack ::Instrumentation . instance . middleware_args_dup
2320 elsif values . include? ( 'http' )
24- app . middleware . insert_before (
25- 0 ,
26- *OpenTelemetry ::Instrumentation ::Rack ::Instrumentation . instance . middleware_args_stable
27- )
21+ OpenTelemetry ::Instrumentation ::Rack ::Instrumentation . instance . middleware_args_stable
2822 else
29- app . middleware . insert_before (
30- 0 ,
31- *OpenTelemetry ::Instrumentation ::Rack ::Instrumentation . instance . middleware_args_old
32- )
23+ OpenTelemetry ::Instrumentation ::Rack ::Instrumentation . instance . middleware_args_old
3324 end
25+
26+ app . middleware . insert_before (
27+ 0 ,
28+ *middleware_args
29+ )
3430 end
3531 end
3632 end
Original file line number Diff line number Diff line change @@ -158,12 +158,10 @@ def untraced_request?(env)
158158 false
159159 end
160160
161- # https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/data- http.md #name
161+ # https://opentelemetry.io/docs/specs/semconv/http/ http-spans/ #name
162162 #
163163 # recommendation: span.name(s) should be low-cardinality (e.g.,
164164 # strip off query param value, keep param name)
165- #
166- # see http://github.com/open-telemetry/opentelemetry-specification/pull/416/files
167165 def create_request_span_name ( request )
168166 # NOTE: dd-trace-rb has implemented 'quantization' (which lowers url cardinality)
169167 # see Datadog::Quantization::HTTP.url
@@ -193,7 +191,7 @@ def request_span_attributes(env)
193191 }
194192
195193 attributes [ 'url.query' ] = env [ 'QUERY_STRING' ] unless env [ 'QUERY_STRING' ] . empty?
196- attributes [ 'http. user_agent' ] = env [ 'HTTP_USER_AGENT' ] if env [ 'HTTP_USER_AGENT' ]
194+ attributes [ 'user_agent.original ' ] = env [ 'HTTP_USER_AGENT' ] if env [ 'HTTP_USER_AGENT' ]
197195 attributes . merge! ( extract_request_headers ( env ) )
198196 attributes
199197 end
Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ def request_span_attributes(env:)
132132 }
133133
134134 attributes [ 'url.query' ] = env [ 'QUERY_STRING' ] unless env [ 'QUERY_STRING' ] . empty?
135- attributes [ 'http. user_agent' ] = env [ 'HTTP_USER_AGENT' ] if env [ 'HTTP_USER_AGENT' ]
135+ attributes [ 'user_agent.original ' ] = env [ 'HTTP_USER_AGENT' ] if env [ 'HTTP_USER_AGENT' ]
136136 attributes . merge! ( allowed_request_headers ( env ) )
137137 end
138138
You can’t perform that action at this time.
0 commit comments