lib/opentelemetry/instrumentation/sinatra/middlewares/tracer_middleware.rb in opentelemetry-instrumentation-sinatra-0.6.0 vs lib/opentelemetry/instrumentation/sinatra/middlewares/tracer_middleware.rb in opentelemetry-instrumentation-sinatra-0.7.0
- old
+ new
@@ -13,15 +13,17 @@
def initialize(app)
@app = app
end
def call(env)
+ span_name = env['sinatra.route'] || env['PATH_INFO']
+
tracer.in_span(
- env['PATH_INFO'],
+ span_name,
attributes: { 'http.method' => env['REQUEST_METHOD'],
'http.url' => env['PATH_INFO'] },
kind: :server,
- with_parent_context: parent_context(env)
+ with_parent: parent_context(env)
) do |span|
app.call(env).tap { |resp| trace_response(span, env, resp) }
end
end