diff --git a/instrumentation/rack/lib/opentelemetry/instrumentation/rack/middlewares/event_handler.rb b/instrumentation/rack/lib/opentelemetry/instrumentation/rack/middlewares/event_handler.rb index 972f0df48..fb1053bb6 100644 --- a/instrumentation/rack/lib/opentelemetry/instrumentation/rack/middlewares/event_handler.rb +++ b/instrumentation/rack/lib/opentelemetry/instrumentation/rack/middlewares/event_handler.rb @@ -142,9 +142,9 @@ def on_finish(request, response) EMPTY_HASH = {}.freeze def extract_request_headers(env) - return EMPTY_HASH if @allowed_request_headers.empty? + return EMPTY_HASH if allowed_request_headers.empty? - @allowed_request_headers.each_with_object({}) do |(key, value), result| + allowed_request_headers.each_with_object({}) do |(key, value), result| result[value] = env[key] if env.key?(key) end end