From 097492624a558ec1e2c2cef35ae215580bde4b53 Mon Sep 17 00:00:00 2001 From: Nectarin Date: Wed, 18 Feb 2026 22:03:27 +0300 Subject: [PATCH] Use coro.__qualname__ with fallbacks --- autodynatrace/wrappers/asyncio/wrapper.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autodynatrace/wrappers/asyncio/wrapper.py b/autodynatrace/wrappers/asyncio/wrapper.py index c3596f2..e005361 100644 --- a/autodynatrace/wrappers/asyncio/wrapper.py +++ b/autodynatrace/wrappers/asyncio/wrapper.py @@ -19,7 +19,11 @@ def dynatrace_coroutine(wrapped, instance, args, kwargs): return wrapped(*args, **kwargs) async def trace_coro(coro: Coroutine): - name = coro.__qualname__ + name = ( + getattr(coro, "__qualname__", None) or + getattr(coro, "__name__", None) or + type(coro).__name__ + ) with sdk.trace_custom_service(name, "asyncio") as tracer: try: logger.debug(f"tracing asyncio.tasks.ensure_future: {name}")