Commit Graph

15769 Commits

Author SHA1 Message Date
Pratik Mankawde
f52673b6c1 feat(telemetry): correct ledger-close-time derivation on dashboards
The "ledger close time" was mis-derived and partly un-queryable:

- Build vs Close Duration derived close time from the consensus.ledger_close
  span, which only wraps the onClose() prologue (~0.8ms live) — not the close.
  Repoint the close series to consensus.round (full round, live P95 ~4.8s).
- The network close-time value (close_time) lived only as a span attribute,
  un-queryable in Prometheus and unfit as a spanmetrics label (monotonic
  timestamp -> unbounded cardinality). Expose it as last_close_time on the
  existing server_info observable gauge (native gauge, no new instrument).
- Add a "Ledger Close Interval & Age" panel to ledger-operations and
  node-health: interval = 1/rate(ledgers_closed_total) (counter-based,
  scrape-independent); age = time() - (last_close_time + epoch_offset).

A gauge delta is deliberately NOT used for the interval — a timestamp gauge's
delta aliases to the scrape period, not the close cadence (verified live).
Guardrail comments in both collector configs record why close_time must never
become a spanmetrics dimension. Docs (09-reference) and the operator runbook
updated to match.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 12:23:21 +01:00
Pratik Mankawde
1f98f2c46a test(telemetry): add rpc_in_flight_requests to phase10 expected_metrics harness inventory 2026-07-21 20:35:12 +01:00
Pratik Mankawde
ce3d806310 Merge branch 'pratik/otel-phase9-metric-gap-fill' into pratik/otel-phase10-workload-validation
Brings the 09-data-collection-reference doc-sync (rpc_in_flight_requests entry)
forward from phase9.
2026-07-21 20:34:12 +01:00
Pratik Mankawde
42615355be docs(telemetry): add rpc_in_flight_requests to metric-surface reference (09-doc) 2026-07-21 20:33:56 +01:00
Pratik Mankawde
0b771c2f41 Merge branch 'pratik/otel-phase9-metric-gap-fill' into pratik/otel-phase10-workload-validation
Brings the call-site metric macros feature (MetricMacros.h + meter() accessor +
2 proof-of-concept call sites + docs) forward from phase9.
2026-07-21 20:20:52 +01:00
Pratik Mankawde
bc432a3244 docs(telemetry): correct incrementLedgersClosed comment (no callers, macro path used) 2026-07-21 20:16:15 +01:00
Pratik Mankawde
3d8af7b66b docs: fix UpDownCounter example to not use _total suffix in metric name 2026-07-21 20:07:28 +01:00
Pratik Mankawde
5f3aed978d docs: document XRPL_METRIC_* call-site macros for adding new metrics 2026-07-21 19:59:58 +01:00
Pratik Mankawde
9b991c9297 perflog: add rpc_in_flight_requests UpDownCounter via XRPL_METRIC_UPDOWN_ADD (proof of concept) 2026-07-21 19:38:40 +01:00
Pratik Mankawde
0992593149 consensus: convert ledgers_closed_total to XRPL_METRIC_COUNTER_INC (proof of concept) 2026-07-21 19:31:58 +01:00
Pratik Mankawde
ae950e1dce telemetry: add missing UpDownCounter no-op stubs to MetricMacros telemetry-off branch 2026-07-21 19:26:55 +01:00
Pratik Mankawde
3170589880 telemetry: add XRPL_METRIC_* call-site macros for lazy counter/histogram registration
Add MetricMacros.h exposing 13 call-site metric macros covering all 7 OTel
instrument kinds (Counter INC/ADD, UpDownCounter, Histogram, sync Gauge, and
Observable Counter/UpDownCounter/Gauge), each with a no-op branch when
XRPL_ENABLE_TELEMETRY is undefined. Sync macros lazily create-once via
std::call_once and cache the instrument at the call site; observable macros
register a callback eagerly. Sync Gauge is ABI-v2-gated with an actionable
static_assert under this repo's ABI v1 build.

Add GTest coverage (8 tests) driving the macros against a bare SDK
MeterProvider via a duck-typed FakeApp/FakeMetricsRegistry, asserting exact
create-once and disabled-gating behavior. No CMakeLists change needed: the
telemetry test-module glob already discovers the new source.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 18:55:43 +01:00
Pratik Mankawde
364cf36c36 telemetry: expose MetricsRegistry::meter() for call-site metric macros 2026-07-21 16:08:10 +01:00
Pratik Mankawde
c0c97da6ad Merge branch 'pratik/otel-phase9-metric-gap-fill' into pratik/otel-phase10-workload-validation 2026-07-21 11:46:00 +01:00
Pratik Mankawde
eceed19f2b Merge branch 'pratik/otel-phase8-log-correlation' into pratik/otel-phase9-metric-gap-fill 2026-07-21 11:45:48 +01:00
Pratik Mankawde
2459ce9a6d Merge branch 'pratik/otel-phase7-native-metrics' into pratik/otel-phase8-log-correlation 2026-07-21 11:45:41 +01:00
Pratik Mankawde
d4eac3cbbc Merge branch 'pratik/otel-phase6-statsd' into pratik/otel-phase7-native-metrics 2026-07-21 11:45:34 +01:00
Pratik Mankawde
fb8455ddb6 Merge branch 'pratik/otel-phase5-docs-deployment' into pratik/otel-phase6-statsd 2026-07-21 11:45:29 +01:00
Pratik Mankawde
160aed7484 Merge branch 'pratik/otel-phase4-consensus-tracing' into pratik/otel-phase5-docs-deployment 2026-07-21 11:45:22 +01:00
Pratik Mankawde
75cbf35e0d Merge branch 'pratik/otel-phase3-tx-tracing' into pratik/otel-phase4-consensus-tracing 2026-07-21 11:45:15 +01:00
Pratik Mankawde
b7037d3872 Merge branch 'pratik/otel-phase2-rpc-tracing' into pratik/otel-phase3-tx-tracing
# Conflicts:
#	src/libxrpl/telemetry/SpanGuard.cpp
2026-07-21 11:45:06 +01:00
Pratik Mankawde
2224f84573 Merge branch 'pratik/otel-phase1c-rpc-integration' into pratik/otel-phase2-rpc-tracing 2026-07-21 11:44:10 +01:00
Pratik Mankawde
dcfaf39b0a Merge branch 'pratik/otel-phase1b-telemetry-infra' into pratik/otel-phase1c-rpc-integration 2026-07-21 11:44:03 +01:00
Pratik Mankawde
8d8bc8b928 fix(telemetry): widen death-test regex for split assert literal, skip under NDEBUG
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 11:41:29 +01:00
Pratik Mankawde
f59682fb75 test(telemetry): convert cross-thread scope-leak negative control to a death test
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 11:30:47 +01:00
Pratik Mankawde
f9b2d725a0 fix(telemetry): assert SpanGuard Scope is destroyed on its constructing thread
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 11:26:29 +01:00
Pratik Mankawde
956dbaa05a Merge branch 'pratik/otel-phase9-metric-gap-fill' into pratik/otel-phase10-workload-validation 2026-07-20 21:52:57 +01:00
Pratik Mankawde
43f622a69c Merge branch 'pratik/otel-phase8-log-correlation' into pratik/otel-phase9-metric-gap-fill 2026-07-20 21:51:46 +01:00
Pratik Mankawde
1b5246d7c3 Merge branch 'pratik/otel-phase7-native-metrics' into pratik/otel-phase8-log-correlation 2026-07-20 21:51:31 +01:00
Pratik Mankawde
e0a472a411 Merge branch 'pratik/otel-phase6-statsd' into pratik/otel-phase7-native-metrics 2026-07-20 21:51:20 +01:00
Pratik Mankawde
a5c692b2be Merge branch 'pratik/otel-phase5-docs-deployment' into pratik/otel-phase6-statsd 2026-07-20 21:51:14 +01:00
Pratik Mankawde
43a9fcaaf8 Merge branch 'pratik/otel-phase4-consensus-tracing' into pratik/otel-phase5-docs-deployment 2026-07-20 21:51:09 +01:00
Pratik Mankawde
82f3c86a28 refactor(telemetry): use detachInPlace() helper at consensus span re-detach call sites
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 21:47:23 +01:00
Pratik Mankawde
95056a49da Merge branch 'pratik/otel-phase3-tx-tracing' into pratik/otel-phase4-consensus-tracing 2026-07-20 21:41:54 +01:00
Pratik Mankawde
9bcc3576f6 Merge branch 'pratik/otel-phase2-rpc-tracing' into pratik/otel-phase3-tx-tracing
# Conflicts:
#	src/libxrpl/telemetry/SpanGuard.cpp
2026-07-20 21:41:45 +01:00
Pratik Mankawde
2a0a14c127 test(telemetry): add SpanGuardScope coverage for detachInPlace() helpers
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 21:37:41 +01:00
Pratik Mankawde
9e61615a08 Merge branch 'pratik/otel-phase1c-rpc-integration' into pratik/otel-phase2-rpc-tracing 2026-07-20 21:33:02 +01:00
Pratik Mankawde
1ed1cb9573 Merge branch 'pratik/otel-phase1b-telemetry-infra' into pratik/otel-phase1c-rpc-integration 2026-07-20 21:32:54 +01:00
Pratik Mankawde
b9c049d7c6 refactor(telemetry): add detachInPlace() helpers to remove hand-rolled SpanGuard re-detach idiom
Add two free functions in xrpl::telemetry that wrap the required
"detach a live SpanGuard held in a container" idiom so call sites write
one line instead of the make_shared/emplace rebuild by hand:

  void                detachInPlace(std::optional<SpanGuard>&);
  std::shared_ptr<SpanGuard> detachInPlace(std::shared_ptr<SpanGuard>);

Both are no-ops on an empty/null/inactive guard. The #else branch adds
matching inline no-op stubs so callers compile with telemetry disabled.
Pure API addition, no behavior change; consumer call sites are rewritten
on phase4 in a follow-up.

The unit tests for these helpers land on phase2, where the telemetry
test module (in-memory-exporter harness + SpanGuardScope.cpp) exists —
mirroring how the detached()/rootSpan() tests were placed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 21:30:05 +01:00
Pratik Mankawde
2cab93a757 Merge branch 'pratik/otel-phase9-metric-gap-fill' into pratik/otel-phase10-workload-validation 2026-07-20 18:06:55 +01:00
Pratik Mankawde
c45a3a9123 fix(telemetry): correct Prometheus metric names in ValidationTracker.h comments
An earlier Doxygen-style normalization pass on this file introduced a
stray xrpld_ prefix into 5 comment references to the validation
counters/gauge. The actual instrument names registered in
MetricsRegistry.cpp have no such prefix (validation_agreements_total,
validation_missed_total, validation_agreement). Comment-only fix.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 18:06:34 +01:00
Pratik Mankawde
c715f561f3 Merge branch 'pratik/otel-phase9-metric-gap-fill' into pratik/otel-phase10-workload-validation
# Conflicts:
#	src/xrpld/telemetry/MetricsRegistry.h
#	src/xrpld/telemetry/ValidationTracker.h
2026-07-20 18:05:24 +01:00
Pratik Mankawde
42468380f6 Merge branch 'pratik/otel-phase8-log-correlation' into pratik/otel-phase9-metric-gap-fill 2026-07-20 17:57:23 +01:00
Pratik Mankawde
30b0d2677a Merge branch 'pratik/otel-phase8-log-correlation' into pratik/otel-phase9-metric-gap-fill
# Conflicts:
#	src/xrpld/telemetry/ValidationTracker.h
2026-07-20 17:57:08 +01:00
Pratik Mankawde
c2c521aa89 Merge branch 'pratik/otel-phase7-native-metrics' into pratik/otel-phase8-log-correlation 2026-07-20 17:56:13 +01:00
Pratik Mankawde
10e71224f3 Merge branch 'pratik/otel-phase6-statsd' into pratik/otel-phase7-native-metrics 2026-07-20 17:56:02 +01:00
Pratik Mankawde
9de79ada34 Merge branch 'pratik/otel-phase5-docs-deployment' into pratik/otel-phase6-statsd 2026-07-20 17:55:52 +01:00
Pratik Mankawde
03e3ae526d Merge branch 'pratik/otel-phase4-consensus-tracing' into pratik/otel-phase5-docs-deployment 2026-07-20 17:55:43 +01:00
Pratik Mankawde
d5d61f9ffb Merge branch 'pratik/otel-phase3-tx-tracing' into pratik/otel-phase4-consensus-tracing 2026-07-20 17:55:33 +01:00
Pratik Mankawde
be268576de Merge branch 'pratik/otel-phase2-rpc-tracing' into pratik/otel-phase3-tx-tracing 2026-07-20 17:55:16 +01:00