feat: Add telemetry traces to callbacks
- Dominant language
- Python
- Stars
- 21.5k
- Forks
- 4k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 37
Description
**Is your feature request related to a problem? Please describe.**
We are developing an application in a highly regulated industry and need to implement strong guardrails in the form of callbacks. We need to understand the latency of our guardrails to optimize them and provide a great user experience. The current implementation of telemetry in the package seems to package up the callback tracing inside the outer agent run. So I can only infer the total time of all callbacks.
**Describe the solution you'd like**
Each callback should be traced and appear separately in the trace UI. I believe this would be a trace_callback function in https://github.com/google/adk-python/blob/main/src/google/adk/telemetry.py
**Describe alternatives you've considered**
I can use a third-party logging tool like logfire or opentelemetry-instrumentation-google-genai to add spans to each of the callbacks but it would be much better if this were built in.
**Additional context**
Callbacks are not broken out:
Contributor guide
Assessment
This issue has not been assessed yet.