diff --git a/src/ripple_app/ledger/InboundLedgers.cpp b/src/ripple_app/ledger/InboundLedgers.cpp index 55b1f48ab..e52f49286 100644 --- a/src/ripple_app/ledger/InboundLedgers.cpp +++ b/src/ripple_app/ledger/InboundLedgers.cpp @@ -28,12 +28,14 @@ public: // How long before we try again to acquire the same ledger static const int kReacquireIntervalSeconds = 300; - InboundLedgersImp (clock_type& clock, Stoppable& parent) + InboundLedgersImp (clock_type& clock, Stoppable& parent, + insight::Collector::ptr const& collector) : Stoppable ("InboundLedgers", parent) , m_clock (clock) , mLock (this, "InboundLedger", __FILE__, __LINE__) , mRecentFailures ("LedgerAcquireRecentFailures", clock, 0, kReacquireIntervalSeconds) + , mCounter(collector->make_counter("ledger_fetches")) { } @@ -61,6 +63,7 @@ public: assert (ret); mLedgers.insert (std::make_pair (hash, ret)); ret->init (sl, couldBeNew); + ++mCounter; } } } @@ -396,6 +399,8 @@ private: uint256 mConsensusLedger; uint256 mValidationLedger; + + beast::insight::Counter mCounter; }; //------------------------------------------------------------------------------ @@ -404,9 +409,10 @@ InboundLedgers::~InboundLedgers() { } -InboundLedgers* InboundLedgers::New (clock_type& clock, Stoppable& parent) +InboundLedgers* InboundLedgers::New (clock_type& clock, Stoppable& parent, + insight::Collector::ptr const& collector) { - return new InboundLedgersImp (clock, parent); + return new InboundLedgersImp (clock, parent, collector); } diff --git a/src/ripple_app/ledger/InboundLedgers.h b/src/ripple_app/ledger/InboundLedgers.h index a66b3b3b3..cd841d21a 100644 --- a/src/ripple_app/ledger/InboundLedgers.h +++ b/src/ripple_app/ledger/InboundLedgers.h @@ -34,7 +34,8 @@ public: // VFALCO TODO Make this a free function outside the class: // std::unique_ptr make_InboundLedgers (...) // - static InboundLedgers* New (clock_type& clock, Stoppable& parent); + static InboundLedgers* New (clock_type& clock, Stoppable& parent, + insight::Collector::ptr const& collector); // VFALCO TODO Should this be called findOrAdd ? // diff --git a/src/ripple_app/main/Application.cpp b/src/ripple_app/main/Application.cpp index 204e9b55e..ff89603a0 100644 --- a/src/ripple_app/main/Application.cpp +++ b/src/ripple_app/main/Application.cpp @@ -264,7 +264,8 @@ public: // VFALCO NOTE must come before NetworkOPs to prevent a crash due // to dependencies in the destructor. // - , m_inboundLedgers (InboundLedgers::New (get_seconds_clock (), *m_jobQueue)) + , m_inboundLedgers (InboundLedgers::New (get_seconds_clock (), *m_jobQueue, + m_collectorManager->collector ())) // VFALCO NOTE Does NetworkOPs depend on LedgerMaster? , m_networkOPs (NetworkOPs::New (get_seconds_clock (), *m_ledgerMaster,