Skip to content

Commit

Permalink
feat: add transactions.mempool.lockedTransactions and chainlocks.bloc…
Browse files Browse the repository at this point in the history
…kHeight stats
  • Loading branch information
PastaPastaPasta committed Aug 28, 2024
1 parent f675fcb commit 8f47ceb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ static void StartupNotify(const ArgsManager& args)
}
#endif

static void PeriodicStats(ArgsManager& args, ChainstateManager& chainman, const CTxMemPool& mempool)
static void PeriodicStats(ArgsManager& args, ChainstateManager& chainman, const CTxMemPool& mempool, const llmq::CInstantSendManager& isman)
{
assert(args.GetBoolArg("-statsenabled", DEFAULT_STATSD_ENABLE));
CCoinsStats stats{CoinStatsHashType::NONE};
Expand Down Expand Up @@ -882,6 +882,7 @@ static void PeriodicStats(ArgsManager& args, ChainstateManager& chainman, const
statsClient.gauge("transactions.mempool.memoryUsageBytes", (int64_t) mempool.DynamicMemoryUsage(), 1.0f);
statsClient.gauge("transactions.mempool.minFeePerKb", mempool.GetMinFee(args.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFeePerK(), 1.0f);
}
statsClient.gauge("transactions.mempool.lockedTransactions", isman.GetInstantSendLockCount(), 1.0f);
}

static bool AppInitServers(NodeContext& node)
Expand Down Expand Up @@ -2241,7 +2242,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)

if (args.GetBoolArg("-statsenabled", DEFAULT_STATSD_ENABLE)) {
int nStatsPeriod = std::min(std::max((int)args.GetArg("-statsperiod", DEFAULT_STATSD_PERIOD), MIN_STATSD_PERIOD), MAX_STATSD_PERIOD);
node.scheduler->scheduleEvery(std::bind(&PeriodicStats, std::ref(*node.args), std::ref(chainman), std::cref(*node.mempool)), std::chrono::seconds{nStatsPeriod});
node.scheduler->scheduleEvery(std::bind(&PeriodicStats, std::ref(*node.args), std::ref(chainman), std::cref(*node.mempool), std::cref(*node.llmq_ctx->isman)), std::chrono::seconds{nStatsPeriod});
}

// ********************************************************* Step 11: import blocks
Expand Down
2 changes: 2 additions & 0 deletions src/llmq/chainlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <util/underlying.h>
#include <validation.h>
#include <validationinterface.h>
#include <statsd_client.h>

namespace llmq
{
Expand Down Expand Up @@ -519,6 +520,7 @@ void CChainLocksHandler::EnforceBestChainLock()

GetMainSignals().NotifyChainLock(currentBestChainLockBlockIndex, clsig);
uiInterface.NotifyChainLock(clsig->getBlockHash().ToString(), clsig->getHeight());
statsClient.gauge("chainlocks.blockHeight", clsig->getHeight(), 1.0f);
}

void CChainLocksHandler::HandleNewRecoveredSig(const llmq::CRecoveredSig& recoveredSig)
Expand Down

0 comments on commit 8f47ceb

Please sign in to comment.