Skip to content

Trace context not propagated - spans have different TraceIDs #439

@eliasecchig

Description

@eliasecchig

Summary

OpenTelemetry spans emitted by ADK have different TraceID values, preventing trace correlation in distributed tracing tools.

Observed Behavior

Each span (call_llm, execute_tool, HTTP POST) has a unique TraceID with no parent:

call_llm:        TraceID: 50ce4e4f...  Parent: 00000000...
execute_tool:    TraceID: 1ffc064e...  Parent: 00000000...
HTTP POST:       TraceID: b2df0a32...  Parent: 00000000...

Expected Behavior

Related spans should share the same TraceID and form a parent-child hierarchy.

Root Cause

In internal/telemetry/telemetry.go, the context from tracer.Start() is discarded:

_, span := tracer.Start(ctx, traceName)  // ctx discarded

Should be:

ctx, span := tracer.Start(ctx, traceName)  // propagate ctx

Workaround

Spans can be correlated via gcp.vertex.agent.invocation_id attribute, but standard trace views don't work.

Environment

  • ADK v0.3.0
  • Go 1.23
  • OpenTelemetry SDK v1.39.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions