Skip to content

[Feat]: Add environment variable to disable A2A SDK telemetry when OpenTelemetry is installed by another library #613

@Abhishek-Nath-WinWire

Description

@Abhishek-Nath-WinWire

Is your feature request related to a problem? Please describe.

When using a2a-sdk[http-server] alongside observability tools like Langfuse that bring OpenTelemetry as a dependency, the A2A SDK's @trace_class decorators automatically activate and emit spans for internal operations (EventQueue, InMemoryTaskStore, etc.).
This pollutes trace dashboards with unwanted internal spans like:

a2a.server.events.event_queue
a2a.server.events.in_memory_task_store

The current _NoOp fallback in telemetry.py only works when OpenTelemetry isn't installed at all — not when it's present but unwanted for A2A internals.

Describe the solution you'd like

Add an environment variable (e.g., A2A_TELEMETRY_DISABLED=true) that forces the _NoOp path in telemetry.py regardless of whether OpenTelemetry is installed.
pythonimport os

if os.getenv("A2A_TELEMETRY_DISABLED", "").lower() == "true":
trace = _NoOp()
else:
try:
from opentelemetry import trace
...

Describe alternatives you've considered

Custom OTEL Sampler: Filter spans by name — adds complexity
Monkey-patching a2a.utils.telemetry: Fragile, breaks on SDK updates
Uninstalling OpenTelemetry: Not possible when other tools require it

Additional context

Similar pattern exists in other SDKs (e.g., Vercel AI SDK's experimental_telemetry option). This would allow users to opt-out of A2A tracing while still using OpenTelemetry for their own instrumentation

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions