File tree Expand file tree Collapse file tree
instrumentation/excon/lib/opentelemetry/instrumentation/excon/middlewares Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,13 +10,16 @@ module Excon
1010 module Middlewares
1111 # Excon middleware for instrumentation
1212 class TracerMiddleware < ::Excon ::Middleware ::Base
13+ HTTP_METHODS_TO_UPPERCASE = Hash . new { |hash , key | hash [ key ] = key . to_s . upcase }
14+ HTTP_METHODS_TO_SPAN_NAMES = Hash . new { |hash , key | hash [ key ] = "HTTP #{ key } " }
15+
1316 def request_call ( datum )
1417 begin
1518 unless datum . key? ( :otel_span )
16- http_method = datum [ :method ] . to_s . upcase
19+ http_method = HTTP_METHODS_TO_UPPERCASE [ datum [ :method ] ]
1720 attributes = span_creation_attributes ( datum , http_method )
1821 tracer . start_span (
19- "HTTP #{ http_method } " ,
22+ HTTP_METHODS_TO_SPAN_NAMES [ http_method ] ,
2023 attributes : attributes ,
2124 kind : :client
2225 ) . tap do |span |
You can’t perform that action at this time.
0 commit comments