lib/opentelemetry/instrumentation/rack/middlewares/tracer_middleware.rb in opentelemetry-instrumentation-rack-0.19.1 vs lib/opentelemetry/instrumentation/rack/middlewares/tracer_middleware.rb in opentelemetry-instrumentation-rack-0.19.2
- old
+ new
@@ -119,21 +119,14 @@
def request_span_attributes(env:)
attributes = {
'http.method' => env['REQUEST_METHOD'],
'http.host' => env['HTTP_HOST'] || 'unknown',
'http.scheme' => env['rack.url_scheme'],
- 'http.target' => fullpath(env)
+ 'http.target' => env['QUERY_STRING'].empty? ? env['PATH_INFO'] : "#{env['PATH_INFO']}?#{env['QUERY_STRING']}"
}
- attributes['http.user_agent'] = env['HTTP_USER_AGENT'] if env['HTTP_USER_AGENT']
- attributes.merge(allowed_request_headers(env))
- end
- # e.g., "/webshop/articles/4?s=1":
- def fullpath(env)
- query_string = env['QUERY_STRING']
- path = env['SCRIPT_NAME'] + env['PATH_INFO']
-
- query_string.empty? ? path : "#{path}?#{query_string}"
+ attributes['http.user_agent'] = env['HTTP_USER_AGENT'] if env['HTTP_USER_AGENT']
+ attributes.merge!(allowed_request_headers(env))
end
# https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/data-http.md#name
#
# recommendation: span.name(s) should be low-cardinality (e.g.,