Commit 49b8dd0
committed
feat: Add OpenTelemetry tracing support with comprehensive testing and null safety
Added OpenTelemetry integration for distributed tracing across the A2A SDK:
- Added @trace annotation for CDI interceptors to create spans on method invocations
- Created SpanInterceptor with robust CDI proxy handling supporting 5 proxy patterns
- Added InvocationContext record for capturing method invocation details with:
* Null safety annotations (@NonNull/@nullable)
* Comprehensive JavaDoc documentation
* Specific exception declarations (IllegalAccessException, InvocationTargetException)
- Implemented attribute extractors for all transport types:
* GrpcAttributeExtractor with null-safe gRPC context key access
* JsonRPCAttributeExtractor with method name extraction
* RestAttributeExtractor with conditional attribute building
* RequestHandlerAttributeExtractor for default request handler
- Added ClientTransportWrapper SPI for wrapping transport operations
- Created OpenTelemetryClientTransport decorator supporting:
* All A2A client methods (sendMessage, getTask, listTasks, etc.)
* Streaming operations with event consumer wrapping
* Error consumer instrumentation
* Helper methods to eliminate code duplication
- Updated ClientBuilder to apply transport wrappers via ServiceLoader
- Added 21 comprehensive tests for OpenTelemetryClientTransport
- Added 12 tests for SpanInterceptor CDI proxy handling
- Added 10 tests for GrpcAttributeExtractor null safety
- All attribute extractors include defensive null checks preventing NPE
- 244 total tests passing in server-common module
- Updated HelloWorld example with OpenTelemetry integration:
* Added OTEL dependencies and configuration
* Configured trace export to console
* Added README documentation for running with telemetry
* Server now includes @trace annotation on agent method
- Added extras/opentelemetry module with dependencies
- Updated BOM with OpenTelemetry extras
- Added CDI beans.xml and ServiceLoader configuration
- Updated .gitignore for IDE and build artifacts
Fixes a2aproject#388
Signed-off-by: Emmanuel Hugonnet <[email protected]>1 parent cf82353 commit 49b8dd0
File tree
44 files changed
+2356
-72
lines changed- boms/extras
- src/it/extras-usage-test
- client
- base/src/main/java/io/a2a/client
- transport
- rest/src/main/java/io/a2a/client/transport/rest
- spi/src/main/java/io/a2a/client/transport/spi
- examples/helloworld
- client
- src/main/java/io/a2a/examples/helloworld
- server
- src/main
- java/io/a2a/examples/helloworld
- resources
- extras/opentelemetry
- src
- main
- java/io/a2a/extras/opentelemetry
- resources/META-INF
- services
- test/java/io/a2a/extras/opentelemetry
- reference/grpc/src/main/java/io/a2a/server/grpc/quarkus
- server-common/src/main/java/io/a2a/server
- interceptors
- requesthandlers
- spec/src/main/java/io/a2a/spec
- transport
- grpc/src
- main/java/io/a2a/transport/grpc
- context
- handler
- test/java/io/a2a/transport/grpc/handler
- jsonrpc/src/main/java/io/a2a/transport/jsonrpc/handler
- rest/src/main/java/io/a2a/transport/rest/handler
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
44 files changed
+2356
-72
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| 26 | + | |
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
37 | 42 | | |
38 | 43 | | |
39 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
47 | 51 | | |
48 | 52 | | |
49 | 53 | | |
| |||
Lines changed: 51 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
24 | 30 | | |
25 | 31 | | |
26 | 32 | | |
| |||
96 | 102 | | |
97 | 103 | | |
98 | 104 | | |
| 105 | + | |
99 | 106 | | |
100 | 107 | | |
101 | 108 | | |
| |||
108 | 115 | | |
109 | 116 | | |
110 | 117 | | |
111 | | - | |
| 118 | + | |
| 119 | + | |
112 | 120 | | |
113 | 121 | | |
114 | 122 | | |
| |||
318 | 326 | | |
319 | 327 | | |
320 | 328 | | |
321 | | - | |
| 329 | + | |
322 | 330 | | |
323 | 331 | | |
324 | 332 | | |
| |||
373 | 381 | | |
374 | 382 | | |
375 | 383 | | |
376 | | - | |
| 384 | + | |
377 | 385 | | |
378 | 386 | | |
379 | 387 | | |
380 | 388 | | |
381 | 389 | | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
382 | 430 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
| |||
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| 41 | + | |
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
| |||
63 | 67 | | |
64 | 68 | | |
65 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
66 | 78 | | |
Lines changed: 81 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
0 commit comments