Skip to content

Add process-wide client diagnostics observers - #51

Draft
NghiaTranUIT wants to merge 1 commit into
grpc:mainfrom
NghiaTranUIT:codex/client-diagnostics-observer
Draft

Add process-wide client diagnostics observers#51
NghiaTranUIT wants to merge 1 commit into
grpc:mainfrom
NghiaTranUIT:codex/client-diagnostics-observer

Conversation

@NghiaTranUIT

@NghiaTranUIT NghiaTranUIT commented Jul 13, 2026

Copy link
Copy Markdown

Related to #50.

Summary

  • adds an opt-in process-wide client diagnostics registry with cancellable registrations and per-call observer snapshots
  • emits logical call and physical retry or hedge attempt lifecycle, peers, post-interceptor metadata, serialized messages, statuses, cancellation, and failures
  • uses synchronous generic borrowed-byte callbacks so observers only copy payloads when needed
  • keeps observer callbacks outside registry locks and gives the disabled path an atomic fast check
  • proposes the public API for gRPC-Swift 2.5

Implementation

Instrumentation sits in ClientRPCExecutor and ClientStreamExecutor, after client interceptors and serialization but before transport compression and TLS. Attempt terminal events are finalized after outbound and inbound work stops, so payload events cannot arrive after attemptFinished.

Safety

Registration is explicit and process-local. Documentation warns that observers receive potentially sensitive metadata and serialized payloads and must return quickly from synchronous callbacks.

Testing

  • unary lifecycle, metadata, and exact serialized request and response bytes
  • bidirectional-streaming message order and sequence numbers
  • retries and hedges sharing one call ID with distinct attempt numbers and terminal events
  • registration cancellation
  • stream-creation failures and exactly-once terminal events
  • full Swift test suite
  • format, import-visibility, and license checks
  • temporary integration verification against both official NIOPosix and NIOTransportServices HTTP/2 transports
  • ad-hoc release throughput comparison over 50,000 in-process unary RPCs with no observer; paired median overhead measured about 0.4 percent, under the proposed 1 percent budget

This remains a draft for maintainer feedback on the API and whether a gRFC or a repository-owned benchmark target is required.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jul 13, 2026

Copy link
Copy Markdown

CLA Not Signed

@NghiaTranUIT
NghiaTranUIT force-pushed the codex/client-diagnostics-observer branch from 53fa875 to c77c0c2 Compare July 13, 2026 07:20
@NghiaTranUIT
NghiaTranUIT force-pushed the codex/client-diagnostics-observer branch from c77c0c2 to 6bacc77 Compare July 13, 2026 07:31
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