Skip to content

Commit 1d5dfa3

Browse files
krnrYuri Lobanoff
authored andcommitted
try..except
1 parent 44ae541 commit 1d5dfa3

File tree

1 file changed

+4
-2
lines changed
  • instrumentation/opentelemetry-instrumentation-aiohttp-server/src/opentelemetry/instrumentation/aiohttp_server

1 file changed

+4
-2
lines changed

instrumentation/opentelemetry-instrumentation-aiohttp-server/src/opentelemetry/instrumentation/aiohttp_server/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,12 @@ def get_default_span_name(request: web.Request) -> str:
245245
The span name.
246246
"""
247247
path = request.path.strip()
248-
if request.match_info and request.match_info.route.resource:
248+
try:
249249
resource = request.match_info.route.resource
250-
if resource.canonical:
250+
if resource:
251251
path = resource.canonical
252+
except AttributeError:
253+
path = "unknown"
252254
return f"{request.method} {path}"
253255

254256

0 commit comments

Comments
 (0)