diff --git a/src/executor/senderManager.ts b/src/executor/senderManager.ts index 87cf1a7e..9e1c980d 100644 --- a/src/executor/senderManager.ts +++ b/src/executor/senderManager.ts @@ -36,6 +36,7 @@ export class SenderManager { private semaphore: Semaphore private gasPriceManager: GasPriceManager private logger: Logger + private walletProcessingTime: Map
= new Map() constructor({ config, @@ -240,7 +241,7 @@ export class SenderManager { ) this.metrics.walletsAvailable.set(this.availableWallets.length) - + this.walletProcessingTime.set(wallet.address, new Date()) return wallet } @@ -251,6 +252,12 @@ export class SenderManager { { executor: wallet.address }, "pushed wallet to sender manager" ) + const processingTime = this.walletProcessingTime.get(wallet.address) + if (processingTime) { + const time = Date.now() - processingTime.getTime() + this.metrics.walletsProcessingTime.set(time) + this.walletProcessingTime.delete(wallet.address) + } this.metrics.walletsAvailable.set(this.availableWallets.length) return } diff --git a/src/utils/metrics.ts b/src/utils/metrics.ts index 3c42b457..e339d283 100644 --- a/src/utils/metrics.ts +++ b/src/utils/metrics.ts @@ -190,6 +190,13 @@ export function createMetrics(registry: Registry, register = true) { registers }) + const walletsProcessingTime = new Gauge({ + name: "alto_executor_wallets_processing_time_seconds", + help: "Time spent processing user operations by executor wallets", + labelNames: [] as const, + registers + }) + return { httpRequests, httpRequestsDuration, @@ -212,6 +219,7 @@ export function createMetrics(registry: Registry, register = true) { utilityWalletInsufficientBalance, executorWalletsBalances, executorWalletsMinBalance, - emittedOpEvents + emittedOpEvents, + walletsProcessingTime } }