fix: flush buffered OTEL logs - #2772
Conversation
Signed-off-by: Yashraj Shukla <shuklayashraj68@gmail.com>
krisztianfekete
left a comment
There was a problem hiding this comment.
Thanks for the PR! Would you mind also fixing this on the Python side, address the comments and add test coverage for both runtimes and both signals?
| return | ||
| } | ||
|
|
||
| flushCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), flushTimeout()) |
There was a problem hiding this comment.
Can we give each provider its own budget, or flush logs first?
| // session's last message). | ||
| // Uses its own detached timeout because the request context is typically | ||
| // already canceled by the time deferred cleanup runs. The timeout defaults to | ||
| // 3s and is configurable via KAGENT_TRACE_FLUSH_TIMEOUT_MS. |
There was a problem hiding this comment.
We probably want to rename this now that it covers both traces and logs.
Signed-off-by: Yashraj Shukla <shuklayashraj68@gmail.com>
|
@krisztianfekete Thanks for the review. I’ve addressed the comments and updated the PR. fix now covers both Go and Python, flushing logs first while keeping a shared timeout budget. also added test coverage for both logs and traces in both runtimes and renamed the timeout setting to KAGENT_TELEMETRY_FLUSH_TIMEOUT_MS |
What
Fix
ForceFlush()so it flushes both the tracer and logger providers.Why
GenAI audit logs are buffered by the OTEL batch log processor. When an Agent Substrate actor checkpoints right after the A2A response closes, those buffered logs can be left behind and never exported.
Changes
LoggerProviderinForceFlush().Validation
go test ./adk/pkg/telemetry ./adk/pkg/a2a/servergo build ./adk/pkg/telemetry ./adk/pkg/a2a/serverAll passed.
Fixes #2759