Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/a2a/utils/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
```
"""

import asyncio
import functools
import inspect
import logging
Expand Down Expand Up @@ -162,23 +163,29 @@
span.set_status(StatusCode.OK)
return result

# asyncio.CancelledError extends from BaseException
except asyncio.CancelledError as ce:
exception = None
logger.debug(f'CancelledError in span {actual_span_name}')
span.record_exception(ce)
raise
except Exception as e:
exception = e
span.record_exception(e)
span.set_status(StatusCode.ERROR, description=str(e))
raise
finally:
if attribute_extractor:
try:
attribute_extractor(
span, args, kwargs, result, exception
)
except Exception as attr_e:
logger.error(
f'attribute_extractor error in span {actual_span_name}: {attr_e}'
)

@functools.wraps(func)

Check notice on line 188 in src/a2a/utils/telemetry.py

View workflow job for this annotation

GitHub Actions / Lint Code Base

Copy/pasted code

see src/a2a/utils/telemetry.py (206-222)
def sync_wrapper(*args, **kwargs) -> Any:
"""Sync Wrapper for the decorator."""
tracer = trace.get_tracer(INSTRUMENTING_MODULE_NAME)
Expand Down
Loading