Phase 1c: RPC telemetry integration — tracing macros, handler instrumentation#6438
Draft
pratikmankawde wants to merge 1 commit intopratik/otel-phase1b-telemetry-infrafrom
Draft
Conversation
1 task
This was referenced Feb 26, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## pratik/otel-phase1b-telemetry-infra #6438 +/- ##
=====================================================================
- Coverage 79.7% 79.7% -0.0%
=====================================================================
Files 851 852 +1
Lines 67872 67895 +23
Branches 7589 7587 -2
=====================================================================
+ Hits 54096 54114 +18
- Misses 13776 13781 +5
🚀 New features to boost your workflow:
|
85325af to
252a4bb
Compare
ff3a7a0 to
1bfdf71
Compare
Add tracing instrumentation to the RPC request handling layer:
TracingInstrumentation.h:
- Convenience macros (XRPL_TRACE_RPC, XRPL_TRACE_TX, etc.) that
create RAII SpanGuard objects when telemetry is enabled
- XRPL_TRACE_SET_ATTR / XRPL_TRACE_EXCEPTION for span enrichment
- Zero-overhead no-ops when XRPL_ENABLE_TELEMETRY is not defined
RPCHandler.cpp:
- Trace each RPC command with span name "rpc.command.<method>"
- Record command name, API version, role, and status as attributes
- Capture exceptions on the span for error visibility
ServerHandler.cpp:
- Trace HTTP requests ("rpc.request"), WebSocket messages
("rpc.ws_message"), and processRequest ("rpc.process")
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1bfdf71 to
b5fb71c
Compare
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.
High Level Overview of Change
Instrument the RPC request handling layer with OpenTelemetry trace spans. Adds convenience macros for zero-overhead conditional tracing and wires them into
RPCHandlerandServerHandler.Stacked PR chain: PR #6436 (Phase 1a) → PR #6437 (Phase 1b) → Phase 1c (this) → PR #6424 → PR #6425 → PR #6426 → PR #6427
Context of Change
Phase 1c of the OpenTelemetry distributed tracing project. With the telemetry infrastructure in place (Phase 1b), this PR adds the instrumentation layer that creates trace spans for RPC operations.
The approach uses preprocessor macros (
XRPL_TRACE_RPC,XRPL_TRACE_SET_ATTR,XRPL_TRACE_EXCEPTION) that expand to RAIISpanGuardobjects whenXRPL_ENABLE_TELEMETRYis defined, and to((void)0)otherwise — zero runtime cost when telemetry is off.The macro design also provides
XRPL_TRACE_TX,XRPL_TRACE_CONSENSUS, andXRPL_TRACE_SPANvariants for future instrumentation phases.Type of Change
API Impact
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)Before / After
Before: RPC requests have no tracing visibility beyond
PerfLogtiming.After: Each RPC request generates trace spans with:
ServerHandler::onRequest()→ spanrpc.requestServerHandler::processSession()→ spanrpc.ws_messageServerHandler::processRequest()→ spanrpc.processcallMethod()→ spanrpc.command.<method>with attributes:xrpl.rpc.command— method namexrpl.rpc.version— API versionxrpl.rpc.role— admin/userxrpl.rpc.status— success/errorFuture Tasks