Repository navigation
feat: add OpenTelemetry plugin with traces - #616
Merged
Merged
Conversation
polchernikova-w
marked this pull request as ready for review
November 18, 2026 18:04
yarolegovich
approved these changes
Nov 23, 2026
This was referenced Nov 24, 2026
Closed
sametakan29
pushed a commit
to sametakan29/a2a-go
that referenced
this pull request
Nov 29, 2026
a2aproject#632) ## Description Part of a2aproject#631 (follow-up from a2aproject#616). Previously, `a2aclient` filled in the request tenant inside `tenantTransportDecorator`, which ran *after* plugins and interceptors. Because of that, `a2aotel` had to guess the tenant on its own and could not see `Config.DisableTenantPropagation` or the endpoint tenant when the client was created without an `AgentCard`. This PR moves tenant resolution into `Client.newRequest` so the tenant is set on a copy of the request payload before plugins and interceptors run: - **`a2aclient`**: Resolve `req.Tenant` in `Client.newRequest` (preserving the same priority: explicit request tenant → endpoint tenant → context tenant unless `DisableTenantPropagation` is set) without modifying the caller's request struct, and remove `tenantTransportDecorator`. - **`integrations/otel/a2aotel`**: Remove `clientTenant` and read `a2a.tenant` directly from the request payload.
sametakan29
pushed a commit
to sametakan29/a2a-go
that referenced
this pull request
Nov 29, 2026
…2aproject#633) ## Description Closes a2aproject#631 (follow-up from a2aproject#616). Previously, when a client transport received an error response without an A2A `ErrorInfo` reason, it mapped the status code to an A2A sentinel error and dropped the original code. The A2A semantic conventions expect the raw status/error code instead. Changes: - **`a2a`**: Add `TransportCode` to `a2a.Error` for transport error responses that have no A2A `ErrorInfo` reason. - **`internal/grpcutil`**, **`internal/rest`**, **`internal/jsonrpc`**: Populate `TransportCode` with the raw gRPC status name (`"UNAVAILABLE"`), HTTP status code (`"503"`), or JSON-RPC error code (`"-32001"`) when no A2A `ErrorInfo` (`domain == "a2a-protocol.org"`) is present. - **`integrations/otel/a2aotel`**: Return `a2aErr.TransportCode` in `clientErrorType` when set.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
integrations/otel/a2aotel, an OpenTelemetry plugin for A2A clients and servers. It's built ona2apluginand follows the A2A semantic convention.This PR adds traces only. Metrics will come in a follow-up; the package layout leaves room for them.
What it emits
a2a.clientCLIENT{a2a.method.name}a2a.serverSERVER{a2a.method.name}Attributes:
a2a.method.name,a2a.protocol.version,a2a.tenant,a2a.message.id,a2a.message.reference_task_ids,a2a.operation.return_immediately,a2a.task.id,a2a.task.state,gen_ai.conversation.id,gen_ai.agent.{name,description,version},error.type, andserver.{address,port}on client spans.Dependencies
Root
go.modnow requiresgo.opentelemetry.io/otel,otel/traceandotel/sdk(tests only), all at v1.44.0. OTel was already in the module graph through gRPC at the same version, so SDK users don't get a higher OTel version.Known limitations (follow-ups)
These need SDK changes and will be fixed in separate PRs:
error.typefor transport failures. Client transports turn responses without an A2A reason into sentinel errors based on the status code, so the original code is lost. For example, gRPCUNAVAILABLEis reported asINTERNAL_ERRORand HTTP 503 asSERVER_ERROR, while the spec wants the raw status code.a2a.tenant. The plugin can't seeConfig.DisableTenantPropagationor the tenant of the endpoint the client picked. It can report a context tenant that isn't sent, or miss an endpoint tenant when the client was created without a card.Tests