Skip to content

Commit

Permalink
Merge pull request #376 from pimlicolabs/util-wallet-insufficient-bal…
Browse files Browse the repository at this point in the history
…ance-metric

introduce a new metric to track utility wallet insufficient balance
  • Loading branch information
nikmel2803 authored Dec 12, 2024
2 parents c5fc5da + bd544bb commit f127c3f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/executor/senderManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export class SenderManager {
{ balancesMissing, totalBalanceMissing },
"balances missing"
)
this.metrics.utilityWalletInsufficientBalance.set(1)
this.logger.error(
{
minBalance,
Expand All @@ -137,6 +138,8 @@ export class SenderManager {
// )
}

this.metrics.utilityWalletInsufficientBalance.set(0)

if (Object.keys(balancesMissing).length > 0) {
const { maxFeePerGas, maxPriorityFeePerGas } =
await this.gasPriceManager.tryGetNetworkGasPrice()
Expand Down
8 changes: 8 additions & 0 deletions src/utils/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ export function createMetrics(registry: Registry, register = true) {
registers
})

const utilityWalletInsufficientBalance = new Gauge({
name: "alto_utility_wallet_insufficient_balance",
help: "Indicates if utility wallet has insufficient balance (0=OK, 1=insufficient)",
labelNames: [] as const,
registers
})

const executorWalletsBalances = new Gauge({
name: "alto_executor_wallet_balance",
help: "Balance of the executor wallet",
Expand Down Expand Up @@ -202,6 +209,7 @@ export function createMetrics(registry: Registry, register = true) {
replacedTransactions,
userOperationsResubmitted,
utilityWalletBalance,
utilityWalletInsufficientBalance,
executorWalletsBalances,
executorWalletsMinBalance,
emittedOpEvents
Expand Down

0 comments on commit f127c3f

Please sign in to comment.