Skip to content

Commit

Permalink
fix: Do not attempt to access headers for all asgi requests (#506)
Browse files Browse the repository at this point in the history
* fix: Do not attempt to access headers for all asgi requests

* fix: Fix NameError
  • Loading branch information
untitaker committed Sep 20, 2019
1 parent da399d6 commit 44c43a8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sentry_sdk/integrations/asgi.py
Expand Up @@ -68,8 +68,14 @@ async def _run_app(self, scope, callback):
)
sentry_scope.add_event_processor(processor)

span = Span.continue_from_headers(dict(scope["headers"]))
span.op = "http.server"
if scope["type"] in ("http", "websocket"):
span = Span.continue_from_headers(dict(scope["headers"]))
span.op = "{}.server".format(scope["type"])
else:
span = Span()
span.op = "asgi.server"

span.set_tag("asgi.type", scope["type"])
span.transaction = "generic ASGI request"

with hub.start_span(span) as span:
Expand Down

0 comments on commit 44c43a8

Please sign in to comment.