Merge branch 'pratik/otel-phase9-metric-gap-fill' into pratik/otel-phase10-workload-validation

# Conflicts:
#	docker/telemetry/grafana/dashboards/fee-market.json
#	docker/telemetry/grafana/dashboards/transaction-overview.json
#	src/xrpld/telemetry/MetricsRegistry.h
This commit is contained in:
Pratik Mankawde
2026-07-10 17:31:39 +01:00
16 changed files with 553 additions and 442 deletions

View File

@@ -254,8 +254,30 @@ MetricsRegistry::initSyncInstruments()
"validations_checked_total", "Total network validations received and checked");
stateChangesCounter_ =
meter_->CreateUInt64Counter("state_changes_total", "Total operating mode changes");
jqTransOverflowCounter_ = meter_->CreateUInt64Counter(
// jq_trans_overflow_total is observed from Overlay's existing cumulative
// atomic (Overlay::getJqTransOverflow()) rather than pushed. The overlay
// owns the only increment site (PeerImp), so an ObservableCounter reads the
// live total each collection cycle without threading a push path through
// develop-owned overlay code.
jqTransOverflowObservable_ = meter_->CreateInt64ObservableCounter(
"jq_trans_overflow_total", "Total job queue transaction overflows");
jqTransOverflowObservable_->AddCallback(
[](opentelemetry::metrics::ObserverResult result, void* state) {
auto* self = static_cast<MetricsRegistry*>(state);
if (self->callbacksDetached_.load(std::memory_order_acquire))
return;
try
{
opentelemetry::nostd::get<opentelemetry::nostd::shared_ptr<
opentelemetry::metrics::ObserverResultT<int64_t>>>(result)
->Observe(static_cast<int64_t>(self->app_.getOverlay().getJqTransOverflow()));
}
catch (...) // NOLINT(bugprone-empty-catch)
{
// Silently skip on error.
}
},
this);
ledgerHistoryMismatchCounter_ = meter_->CreateUInt64Counter(
"ledger_history_mismatch_total", "Total built-vs-validated ledger mismatches by reason");
txqExpiredCounter_ = meter_->CreateUInt64Counter(
@@ -1458,15 +1480,6 @@ MetricsRegistry::incrementStateChanges()
#endif
}
void
MetricsRegistry::incrementJqTransOverflow()
{
#ifdef XRPL_ENABLE_TELEMETRY
if (enabled_ && jqTransOverflowCounter_)
jqTransOverflowCounter_->Add(1);
#endif
}
void
MetricsRegistry::incrementLedgerHistoryMismatch(std::string_view reason)
{

View File

@@ -36,7 +36,6 @@
| +-- validations_sent_total
| +-- validations_checked_total
| +-- state_changes_total
| +-- jq_trans_overflow_total
| +-- ledger_history_mismatch_total{reason}
| +-- txq_expired_total
| +-- txq_dropped_total{reason}
@@ -61,6 +60,7 @@
+-- State tracking (mode value, time in state)
+-- Storage detail (NuDB sizes)
+-- Validation agreement (1h/24h pct, counts)
+-- jq_trans_overflow_total (observed from Overlay)
Control-flow for async gauges:
@@ -347,13 +347,6 @@ public:
void
incrementStateChanges();
/** Increment the jq_trans_overflow_total counter.
Called when the job queue transaction limit overflows (mirrors
Overlay::incJqTransOverflow()).
*/
void
incrementJqTransOverflow();
/** Increment the ledger_history_mismatch_total counter for a reason.
Called from LedgerHistory::handleMismatch() once the mismatch has
been classified. The reason label turns fork diagnosis from a
@@ -517,9 +510,10 @@ private:
/// Counter: state_changes_total — incremented on operating mode transitions.
opentelemetry::nostd::unique_ptr<opentelemetry::metrics::Counter<uint64_t>>
stateChangesCounter_;
/// Counter: jq_trans_overflow_total — incremented on job queue transaction overflows.
opentelemetry::nostd::unique_ptr<opentelemetry::metrics::Counter<uint64_t>>
jqTransOverflowCounter_;
/// ObservableCounter: jq_trans_overflow_total — observed from
/// Overlay::getJqTransOverflow() (cumulative overflow tally owned by the overlay).
opentelemetry::nostd::shared_ptr<opentelemetry::metrics::ObservableInstrument>
jqTransOverflowObservable_;
/// Counter: ledger_history_mismatch_total{reason} — incremented per classified
/// built-vs-validated ledger mismatch.
opentelemetry::nostd::unique_ptr<opentelemetry::metrics::Counter<uint64_t>>