diff --git a/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py b/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py index 608aeade7f..46bad6672c 100644 --- a/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py @@ -260,7 +260,8 @@ def get( return decoded def keys(self, carrier: dict) -> typing.List[str]: - return [_key.decode("utf8") for (_key, _value) in carrier] + headers = carrier.get("headers") or [] + return [_key.decode("utf8") for (_key, _value) in headers] asgi_getter = ASGIGetter()