a2aproject/a2a-python

[Feat]: Add a switch to enable or disable OpenTelemetry reporting

Brant-lzh opened this issue · 7 comments

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

Currently, OpenTelemetry reporting is always enabled in the code. In some cases, we want to disable it for local development or troubleshooting.

Describe the solution you'd like

Add a configuration option (e.g., environment variable or function parameter) to control whether OpenTelemetry tracing is enabled.

Describe alternatives you've considered

No response

Additional context

No response

Code of Conduct

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

Thanks for reporting thie @Brant-lzh A quick question though, though telemetry is enabled, all of it is no-op if you do not register and configure your tracer. Curious to understand more about your use-case.

I have a similar situation. I use Google's A2A and ADK in conjunction and collect telemetry information with langfuse.

However, I want to disable A2A because the information collected from A2A is too much and noisy. If I disable OTEL collection itself, there is a problem that ADK information is not collected either.

I also have a similar situation. I'm only interested in the actual internal agent traces and not the noisy a2a traces which you can't turn off which can can see from the screenshot.

with crewai you can set-up the otel logging with the following command

from langfuse import get_client
langfuse = get_client()
if langfuse.auth_check():
print("Langfuse client is authenticated and ready!")
else:
print("Authentication failed. Please check your credentials and host.")
import openlit
openlit.init()

I can't get a working solution to exclude the a2a-python-sdk scope from the span, and the a2a sdk doesn't have the ability to surpress or turn it it just for your library.

Image

@rajeshvelicheti thx

I'm using a2a with LangGraph, and my use case requires me to report telemetry only for LangGraph data, not for a2a data.

I did manage to create a custom collector and then exclude the noisy a2a traces with this matching scope if this helps.

Comprehensive filter to exclude a2a spans

filter/exclude-a2a:
error_mode: ignore
traces:
span:
- 'IsMatch(name, "a2a")'
- 'IsMatch(attributes["service.name"], "a2a")'
- 'instrumentation_scope.name == "a2a-python-sdk"'

Hey! I can implement this. Who can decide whether we’ll take this feature into development or not? @holtskinner

@rajeshvelicheti thx

I'm using a2a with LangGraph, and my use case requires me to report telemetry only for LangGraph data, not for a2a data.

I also using a2a-python with LangGraph,
in my case, I resolve that issue using filtering-by-instrumentation-scope

from langfuse import Langfuse

langfuse = Langfuse(
    blocked_instrumentation_scopes=["a2a-python-sdk"]
)

Langfuse tracing client is implemented as a singleton internally.
Important point, Ensure the code above run before calling get_client() or CallbackHandler.