Skip to content

feat(observability): add observability core module, TelemetryHook SPI and facade wiring - #205

Open
khunj wants to merge 20 commits into
project-openan:mainfrom
khunj:feature/observability-core
Open

khunj wants to merge 20 commits into
project-openan:mainfrom
khunj:feature/observability-core

Conversation

@khunj

@khunj khunj commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

What

Implements the A2A-T Java SDK observability layer (Plan A of the Java port of the a2a-t-sdk-python observability module), per the design doc docs/superpowers/specs/2026-10-20-observability-java-port-design.md:

  • New module �2a-t-observability: A2ATObservabilityConfig (explicit > .env > env > defaults, 14 env keys), ObservabilitySetup (idempotent OTel 3-signal auto-setup: OTLP gRPC/HTTP + in-house Console fallback), manual span API (A2ATSpan/CurrentSpans), W3C raceparent propagation (TracePropagation), payload channels (PayloadExtractor + PayloadSanitizer, redact-then-truncate), LLM token metric + ThreadLocal usage stash (ObservabilityLLMClient), negotiation rounds metric (NegotiationMetrics), structured JSON logs on SLF4J + OTel Logger dual channel (ObservabilityLogs), and attribute constants/extractors byte-identical to the Python SDK naming registry.
  • New module skeleton �2a-t-observability-a2a: hosts the future a2a-java protocol-level decorators (Plan B, separate PR); pins a2a-java 1.1.0.Final in its own pom so root dependencyManagement cannot break sample transitive resolution.
  • �2a-t-core: TelemetryHook/TelemetryOperation SPI with a NO_OP default — telemetry can never break the business flow (all callbacks guarded, WARN + fallback).
  • �2a-t-client / �2a-t-server: secondary constructors A2ATClient(Path, @nullable TelemetryHook) / A2ATServer(Path, @nullable TelemetryHook); all 45 public facade methods wrapped as �2at.sdk.{role}.{method} spans; terminal negotiation rounds reported from continueNegotiation (AGREED→accept, REJECTED→reject).
  • env.example: observability section (14 keys).

Why

The Python SDK ships a full observability layer (spans, metrics, logs, propagation) targeting a2a-java dashboard parity; the Java SDK had none. This port keeps every span name, attribute key, metric name/unit and log event byte-identical to the Python SDK so existing dashboards work unchanged, while adapting the architecture to Java idioms: OTel api as a compile dependency with sdk/exporters , a hook SPI instead of instance duck-typing, and ThreadLocal instead of contextvar for the LLM usage stash.

Notes

  • OTel 1.64.0 API adaptations (javap-verified): GlobalOpenTelemetry.getOrNoop() everywhere except the single intentional set() in setup (prevents get() auto-set poisoning that would silently disable auto-setup); no Java-21 pattern switches;
    esetForTest(); in-house Console exporters (opentelemetry-exporter-logging is not vendored).
  • Verified: 9-module regression green (�2a-t-sample has a pre-existing AgentCard compile error unrelated to this PR and predating this branch; �2a-t-corpus is test-asset only).
  • Deferred follow-ups and Plan B inputs are recorded at the end of the plan doc (docs/superpowers/plans/2026-10-20-observability-core.md).

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Other (corpus test-asset addition: input case JSONs only, no SDK source change)

Checklist

  • I have read the CONTRIBUTING guide
  • All commits are signed off (git commit -s) per the DCO
  • New and existing tests pass locally
  • I have added tests that prove my fix is effective or my feature works (if applicable)
  • I have added or updated documentation as needed
  • New source files include the SPDX license header (repo-wide convention carries no SPDX headers; pom declares Apache-2.0 — will add on reviewer request)

@khunj
khunj requested a review from a team as a code owner October 21, 2026 12:15
khunj added 16 commits October 23, 2026 15:21
Signed-off-by: z00930736 <zoujie5@huawei.com>
…y registration

Signed-off-by: z00930736 <zoujie5@huawei.com>
Signed-off-by: z00930736 <zoujie5@huawei.com>
Signed-off-by: z00930736 <zoujie5@huawei.com>
Signed-off-by: z00930736 <zoujie5@huawei.com>
…text

Signed-off-by: z00930736 <zoujie5@huawei.com>
Signed-off-by: z00930736 <zoujie5@huawei.com>
Signed-off-by: z00930736 <zoujie5@huawei.com>
…n rounds metric

Signed-off-by: z00930736 <zoujie5@huawei.com>
…auto-setup

Signed-off-by: z00930736 <zoujie5@huawei.com>
…mple transitive resolution

Signed-off-by: z00930736 <zoujie5@huawei.com>
Signed-off-by: z00930736 <zoujie5@huawei.com>
…module

Signed-off-by: z00930736 <zoujie5@huawei.com>
… tautology test

Signed-off-by: z00930736 <zoujie5@huawei.com>
Signed-off-by: z00930736 <zoujie5@huawei.com>
Signed-off-by: z00930736 <zoujie5@huawei.com>
@khunj
khunj force-pushed the feature/observability-core branch from ff742c2 to dc6e770 Compare October 23, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant