From 736579e4736c237b38a0ad10298cfa0355dac2b5 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Mon, 20 Apr 2026 14:06:08 +0100 Subject: [PATCH] refactor(telemetry): extract span name constants into modular headers Centralise scattered string literals into compile-time constants using StaticStr and join() for dot-separated composition. Shared primitives live in SpanNames.h; RPC-specific names in RpcSpanNames.h. Future modules (consensus, peer, ledger) add their own *SpanNames.h without bloating the central header. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/xrpld/rpc/detail/RpcSpanNames.h | 93 ----------------------------- 1 file changed, 93 deletions(-) diff --git a/src/xrpld/rpc/detail/RpcSpanNames.h b/src/xrpld/rpc/detail/RpcSpanNames.h index a8139f851a..a10fd1af3e 100644 --- a/src/xrpld/rpc/detail/RpcSpanNames.h +++ b/src/xrpld/rpc/detail/RpcSpanNames.h @@ -16,97 +16,6 @@ * span.setAttribute(rpc_span::attr::command, "submit"); * span.setAttribute(rpc_span::attr::status, rpc_span::val::success); * @endcode - * - * Span hierarchy (automatic nesting via OTel thread-local context): - * - * HTTP JSON-RPC path (single request): - * - * +-------------------------------------------------------+ - * | rpc.http_request | - * | ServerHandler::processSession(Session) | - * | | - * | +--------------------------------------------------+ | - * | | rpc.process | | - * | | ServerHandler::processRequest() | | - * | | | | - * | | +---------------------------------------------+ | | - * | | | rpc.command.{name} | | | - * | | | RPC::callMethod() | | | - * | | | attrs: command, version, role, status | | | - * | | +---------------------------------------------+ | | - * | +--------------------------------------------------+ | - * +-------------------------------------------------------+ - * - * HTTP batch path (multiple commands per request): - * - * +-------------------------------------------------------+ - * | rpc.http_request | - * | | - * | +--------------------------------------------------+ | - * | | rpc.process | | - * | | | | - * | | +------------------+ +------------------+ | | - * | | | rpc.command.{a} | | rpc.command.{b} | ... | | - * | | +------------------+ +------------------+ | | - * | +--------------------------------------------------+ | - * +-------------------------------------------------------+ - * - * WebSocket path: - * - * +-------------------------------------------------------+ - * | rpc.ws_message | - * | ServerHandler::processSession(WSSession) | - * | | - * | +--------------------------------------------------+ | - * | | rpc.command.{name} | | - * | | RPC::callMethod() | | - * | | attrs: command, version, role, status | | - * | +--------------------------------------------------+ | - * +-------------------------------------------------------+ - * - * WebSocket error paths: - * - * +-------------------------------------------------------+ - * | rpc.ws_message (error: invalid_json) | - * | ServerHandler::onWSMessage() — parse failure | - * +-------------------------------------------------------+ - * - * +-------------------------------------------------------+ - * | rpc.ws_upgrade | - * | ServerHandler::onHandoff() — upgrade try/catch | - * +-------------------------------------------------------+ - * - * Command dispatch error path: - * - * +-------------------------------------------------------+ - * | rpc.command.{name} (error: too_busy/unknown/etc) | - * | RPC::doCommand() — fillHandler() rejection | - * +-------------------------------------------------------+ - * - * gRPC path (see GrpcSpanNames.h for constants): - * - * +-------------------------------------------------------+ - * | grpc.request | - * | CallData::process(coro) | - * | attrs: method, status | - * +-------------------------------------------------------+ - * - * Covered paths: - * - HTTP JSON-RPC (single and batch requests) - * - WebSocket RPC commands - * - WebSocket message parse errors (invalid JSON, oversized) - * - WebSocket upgrade failures (protocol handshake errors) - * - Admin CLI (connects via HTTP internally) - * - Command dispatch rejections (unknown cmd, too busy, no perm) - * - gRPC endpoints (GetLedger, GetLedgerData, GetLedgerDiff, - * GetLedgerEntry) - * - Command execution: timing, success/failure, exceptions - * - Per-command attributes: name, API version, role, status - * - * Known gaps (not yet instrumented): - * - Early validation errors in processRequest() before rpc.process - * span (malformed JSON, auth failures, oversized requests) - * - Subscription push notifications (server-initiated, not RPC) */ #include @@ -128,7 +37,6 @@ inline constexpr auto command = join(seg::rpc, makeStr("command")); namespace op { inline constexpr auto wsMessage = makeStr("ws_message"); -inline constexpr auto wsUpgrade = makeStr("ws_upgrade"); inline constexpr auto httpRequest = makeStr("http_request"); inline constexpr auto process = makeStr("process"); } // namespace op @@ -157,7 +65,6 @@ using telemetry::attr_val::error; using telemetry::attr_val::success; inline constexpr auto admin = makeStr("admin"); inline constexpr auto user = makeStr("user"); -inline constexpr auto unknownCommand = makeStr("unknown"); } // namespace val } // namespace rpc_span