You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
runner: start a span before BeforeRunCallback so plugin rows share the invocation's trace #1884
ADK Go opens its first OpenTelemetry span in agent.Run (agent.go#L163). That happens after the runner has already called OnUserMessageCallback and BeforeRunCallback (runner.go#L702-L714), so rows a plugin writes in those two callbacks can't carry the trace ID of ADK's spans.
With #1787 and ADK telemetry on, the BigQuery Agent Analytics plugin writes USER_MESSAGE_RECEIVED and INVOCATION_STARTING under one trace ID and every later row of the same invocation under ADK's (trace_manager.go#L319-L337). The same span_id (the invocation span) therefore appears under two trace IDs, and anything that rebuilds a trace by trace_id splits the invocation in two.
If I understand correctly, the invocation span needs to start before OnUserMessageCallback as well as BeforeRunCallback, so the early plugin events share the same trace as the agent execution. It should also inherit any existing parent trace. RunLive seems worth checking separately, since the session continues after the method returns. Does that sound right?
Activity
ktsoator commentedon Oct 17, 2026
If I understand correctly, the invocation span needs to start before OnUserMessageCallback as well as BeforeRunCallback, so the early plugin events share the same trace as the agent execution. It should also inherit any existing parent trace. RunLive seems worth checking separately, since the session continues after the method returns. Does that sound right?
ktsoator commentedon Oct 18, 2026
I've opened #1898 with a proposed fix. If anyone spots something I've missed or has a better approach, I'd be happy to hear it and learn from it.
Thx! :)