mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Report the validated and publish ledger ages over insight
This commit is contained in:
@@ -371,6 +371,35 @@ private:
|
|||||||
// without first wiping the database.
|
// without first wiping the database.
|
||||||
LedgerIndex const max_ledger_difference_ {1000000};
|
LedgerIndex const max_ledger_difference_ {1000000};
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct Stats
|
||||||
|
{
|
||||||
|
template <class Handler>
|
||||||
|
Stats (Handler const& handler, beast::insight::Collector::ptr const& collector)
|
||||||
|
: hook (collector->make_hook (handler))
|
||||||
|
, validatedLedgerAge (collector->make_gauge ("LedgerMaster", "Validated_Ledger_Age"))
|
||||||
|
, publishedLedgerAge (collector->make_gauge ("LedgerMaster", "Published_Ledger_Age"))
|
||||||
|
{ }
|
||||||
|
|
||||||
|
beast::insight::Hook hook;
|
||||||
|
beast::insight::Gauge validatedLedgerAge;
|
||||||
|
beast::insight::Gauge publishedLedgerAge;
|
||||||
|
};
|
||||||
|
|
||||||
|
Stats m_stats;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void collect_metrics()
|
||||||
|
{
|
||||||
|
std::lock_guard lock (m_mutex);
|
||||||
|
m_stats.validatedLedgerAge.set(getValidatedLedgerAge().count());
|
||||||
|
m_stats.publishedLedgerAge.set(getPublishedLedgerAge().count());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // ripple
|
} // ripple
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ LedgerMaster::LedgerMaster (Application& app, Stopwatch& stopwatch,
|
|||||||
, ledger_fetch_size_ (app_.config().getValueFor(SizedItem::ledgerFetch))
|
, ledger_fetch_size_ (app_.config().getValueFor(SizedItem::ledgerFetch))
|
||||||
, fetch_packs_ ("FetchPack", 65536, std::chrono::seconds {45}, stopwatch,
|
, fetch_packs_ ("FetchPack", 65536, std::chrono::seconds {45}, stopwatch,
|
||||||
app_.journal("TaggedCache"))
|
app_.journal("TaggedCache"))
|
||||||
|
, m_stats(std::bind (&LedgerMaster::collect_metrics, this),collector)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user