refactor(telemetry): fix remaining old attr refs in tests, docs, workload

- Update Telemetry.h doc example: xrpl.rpc.command -> command.
- Update SpanGuardFactory.cpp test: use new bare attr names.
- Update TESTING.md: rename attr refs in span table + PromQL example.
- Update expected_spans.json: all attrs match simplified naming.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Pratik Mankawde
2026-05-13 16:21:18 +01:00
parent ec8e3e2950
commit 815e2b1f5d
4 changed files with 39 additions and 48 deletions

View File

@@ -381,8 +381,8 @@ All 16 production span names instrumented across Phases 2-5:
| `rpc.request` | ServerHandler.cpp:271 | 2 | -- | Any HTTP RPC call |
| `rpc.process` | ServerHandler.cpp:573 | 2 | -- | Any HTTP RPC call |
| `rpc.ws_message` | ServerHandler.cpp:384 | 2 | -- | WebSocket RPC message |
| `rpc.command.<name>` | RPCHandler.cpp:161 | 2 | `xrpl.rpc.command`, `xrpl.rpc.version`, `xrpl.rpc.role` | Any RPC command |
| `tx.process` | NetworkOPs.cpp:1227 | 3 | `xrpl.tx.hash`, `xrpl.tx.local`, `xrpl.tx.path` | Submit transaction |
| `rpc.command.<name>` | RPCHandler.cpp:161 | 2 | `command`, `version`, `rpc_role` | Any RPC command |
| `tx.process` | NetworkOPs.cpp:1227 | 3 | `xrpl.tx.hash`, `local`, `path` | Submit transaction |
| `tx.receive` | PeerImp.cpp:1273 | 3 | `xrpl.peer.id` | Peer relays transaction |
| `consensus.proposal.send` | RCLConsensus.cpp:177 | 4 | `xrpl.consensus.round` | Consensus proposing phase |
| `consensus.ledger_close` | RCLConsensus.cpp:282 | 4 | `xrpl.consensus.ledger.seq`, `xrpl.consensus.mode` | Ledger close event |
@@ -444,7 +444,7 @@ curl -s "$PROM/api/v1/query?query=traces_span_metrics_duration_milliseconds_coun
# RPC calls by command
curl -s "$PROM/api/v1/query?query=traces_span_metrics_calls_total{span_name=~\"rpc.command.*\"}" \
| jq '.data.result[] | {command: .metric["xrpl.rpc.command"], count: .value[1]}'
| jq '.data.result[] | {command: .metric["command"], count: .value[1]}'
```
### Grafana

View File

@@ -27,13 +27,11 @@
"category": "rpc",
"parent": "rpc.process",
"required_attributes": [
"xrpl.rpc.command",
"xrpl.rpc.version",
"xrpl.rpc.role",
"xrpl.rpc.status",
"xrpl.rpc.duration_ms",
"xrpl.node.amendment_blocked",
"xrpl.node.server_state"
"command",
"version",
"rpc_role",
"rpc_status",
"duration_ms"
],
"config_flag": "trace_rpc",
"note": "Wildcard — matches rpc.command.server_info, rpc.command.ledger, etc."
@@ -42,7 +40,7 @@
"name": "tx.process",
"category": "transaction",
"parent": null,
"required_attributes": ["xrpl.tx.hash", "xrpl.tx.local", "xrpl.tx.path"],
"required_attributes": ["xrpl.tx.hash", "local", "path"],
"config_flag": "trace_transactions"
},
{
@@ -52,8 +50,8 @@
"required_attributes": [
"xrpl.peer.id",
"xrpl.tx.hash",
"xrpl.tx.suppressed",
"xrpl.tx.status"
"suppressed",
"tx_status"
],
"config_flag": "trace_transactions"
},
@@ -61,11 +59,7 @@
"name": "tx.apply",
"category": "transaction",
"parent": "ledger.build",
"required_attributes": [
"xrpl.ledger.seq",
"xrpl.ledger.tx_count",
"xrpl.ledger.tx_failed"
],
"required_attributes": ["xrpl.ledger.seq", "tx_count", "tx_failed"],
"config_flag": "trace_transactions"
},
{
@@ -79,10 +73,7 @@
"name": "consensus.ledger_close",
"category": "consensus",
"parent": null,
"required_attributes": [
"xrpl.consensus.ledger.seq",
"xrpl.consensus.mode"
],
"required_attributes": ["xrpl.ledger.seq", "xrpl.consensus.mode"],
"config_flag": "trace_consensus"
},
{
@@ -90,9 +81,9 @@
"category": "consensus",
"parent": null,
"required_attributes": [
"xrpl.consensus.proposers",
"xrpl.consensus.validation_quorum",
"xrpl.consensus.proposers_validated"
"proposers",
"validation_quorum",
"proposers_validated"
],
"config_flag": "trace_consensus"
},
@@ -101,10 +92,10 @@
"category": "consensus",
"parent": null,
"required_attributes": [
"xrpl.consensus.ledger.seq",
"xrpl.consensus.proposing",
"xrpl.validation.ledger_hash",
"xrpl.validation.full"
"xrpl.ledger.seq",
"proposing",
"xrpl.ledger.hash",
"validation_full"
],
"config_flag": "trace_consensus"
},
@@ -113,12 +104,12 @@
"category": "consensus",
"parent": null,
"required_attributes": [
"xrpl.consensus.close_time",
"xrpl.consensus.ledger.seq",
"xrpl.consensus.parent_close_time",
"xrpl.consensus.close_time_self",
"xrpl.consensus.close_time_vote_bins",
"xrpl.consensus.resolution_direction"
"close_time",
"xrpl.ledger.seq",
"parent_close_time",
"close_time_self",
"close_time_vote_bins",
"resolution_direction"
],
"config_flag": "trace_consensus"
},
@@ -128,11 +119,11 @@
"parent": null,
"required_attributes": [
"xrpl.ledger.seq",
"xrpl.ledger.tx_count",
"xrpl.ledger.tx_failed",
"xrpl.ledger.close_time",
"xrpl.ledger.close_time_correct",
"xrpl.ledger.close_resolution_ms"
"tx_count",
"tx_failed",
"close_time",
"close_time_correct",
"close_resolution_ms"
],
"config_flag": "trace_ledger"
},
@@ -140,7 +131,7 @@
"name": "ledger.validate",
"category": "ledger",
"parent": null,
"required_attributes": ["xrpl.ledger.seq", "xrpl.ledger.validations"],
"required_attributes": ["xrpl.ledger.seq", "validations"],
"config_flag": "trace_ledger"
},
{
@@ -154,7 +145,7 @@
"name": "peer.proposal.receive",
"category": "peer",
"parent": null,
"required_attributes": ["xrpl.peer.id", "xrpl.peer.proposal.trusted"],
"required_attributes": ["xrpl.peer.id", "proposal_trusted"],
"config_flag": "trace_peer"
},
{
@@ -163,9 +154,9 @@
"parent": null,
"required_attributes": [
"xrpl.peer.id",
"xrpl.peer.validation.trusted",
"xrpl.peer.validation.ledger_hash",
"xrpl.peer.validation.full"
"validation_trusted",
"xrpl.ledger.hash",
"validation_full"
],
"config_flag": "trace_peer"
}

View File

@@ -50,7 +50,7 @@
if (telemetry.isEnabled() && telemetry.shouldTraceRpc())
{
SpanGuard guard(telemetry.startSpan("rpc.command.submit"));
guard.setAttribute("xrpl.rpc.command", "submit");
guard.setAttribute("command", "submit");
// ... guard ends span automatically on scope exit
}
@endcode

View File

@@ -30,8 +30,8 @@ TEST(SpanGuardFactory, category_span_returns_null_when_disabled)
auto span = SpanGuard::span(TraceCategory::Rpc, "rpc", "test");
EXPECT_FALSE(span);
span.setAttribute("xrpl.rpc.command", "test");
span.setAttribute("xrpl.rpc.status", "success");
span.setAttribute("command", "test");
span.setAttribute("rpc_status", "success");
}
TEST(SpanGuardFactory, child_span_null_when_no_parent)