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
Commit ec67db0
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/EventStreamObserver_v0_3.java
Copy file name to clipboardExpand all lines: docs/content/dev/extra/opentelemetry.md
+95Lines changed: 95 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ Adds distributed tracing and context propagation to A2A servers and clients usin
14
14
-**Context Propagation**: OpenTelemetry trace context propagation across async operations
15
15
-**Request/Response Logging**: Optional extraction of request and response data into spans
16
16
-**Error Tracking**: Automatic error status and error type attributes on failures
17
+
-**Metrics**: `gen_ai.client.operation.duration` histogram on the client side; `gen_ai.agent.a2a.streaming.duration` histogram for full streaming lifecycle on the server side
Streaming methods (`message/stream` and `tasks/resubscribe`) follow a two-span model to correctly represent the full duration of a streaming response.
72
+
73
+
**Span 1 — method span** is created when the request arrives and ended as soon as the publisher is returned to the transport layer. It captures request attributes and the initial outcome (success or synchronous error).
74
+
75
+
**Per-event child spans** (`<method>-event`) are created for each streaming event published via `onNext()`. Each child span carries a [link](https://opentelemetry.io/docs/concepts/signals/traces/#span-links) back to Span 1 and is made the current span during delegate execution, so any nested telemetry is correctly parented.
76
+
77
+
**Span 2 — end span** (`<method>-end`) is created when the stream terminates — either on completion or error. It also carries a link to Span 1 for correlation.
|`gen_ai.agent.a2a.task.status.state`| Task status state (for `TaskStatusUpdateEvent` and `Task` events) |
119
+
|`gen_ai.agent.a2a.task_id`| Task identifier (when available from the event) |
120
+
121
+
### Metrics
122
+
123
+
The server decorator records the following histogram instruments:
124
+
125
+
| Instrument | Type | Unit | Description |
126
+
|------------|------|------|-------------|
127
+
|`gen_ai.agent.a2a.streaming.duration`| Histogram |`s`| Duration from stream initiation to last event, for `message/stream` and `tasks/resubscribe`|
128
+
129
+
Attributes on `gen_ai.agent.a2a.streaming.duration`:
130
+
131
+
| Attribute | Value |
132
+
|-----------|-------|
133
+
|`gen_ai.agent.a2a.operation.name`| A2A method name (`message/stream` or `tasks/resubscribe`) |
134
+
|`gen_ai.system`|`a2a`|
135
+
|`error.type`|`error` (only on stream failure) |
136
+
137
+
Meter injection uses CDI `Instance<Meter>`, so the histogram is silently skipped if no `Meter` bean is available in the container.
138
+
68
139
### Context-Aware Async Executor
69
140
70
141
> **Note:** The `AsyncManagedExecutorProducer` is provided by the **Quarkus reference server** ([`reference/common`](https://github.com/a2aproject/a2a-java/blob/main/reference/common/src/main/java/org/a2aproject/sdk/server/common/quarkus/AsyncManagedExecutorProducer.java)), not the OpenTelemetry module. It is documented here because it enables context propagation (including trace context) across async boundaries.
Copy file name to clipboardExpand all lines: examples/helloworld/client/src/main/java/org/a2aproject/sdk/examples/helloworld/client/HelloWorldClient.java
0 commit comments