Skip to content

Commit

Permalink
Ass walletProcessingTime metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
plusminushalf committed Dec 18, 2024
1 parent ba16716 commit 0c1e874
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/executor/senderManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class SenderManager {
private semaphore: Semaphore
private gasPriceManager: GasPriceManager
private logger: Logger
private walletProcessingTime: Map<Address, Date> = new Map()

constructor({
config,
Expand Down Expand Up @@ -240,7 +241,7 @@ export class SenderManager {
)

this.metrics.walletsAvailable.set(this.availableWallets.length)

this.walletProcessingTime.set(wallet.address, new Date())
return wallet
}

Expand All @@ -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
}
Expand Down
10 changes: 9 additions & 1 deletion src/utils/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -212,6 +219,7 @@ export function createMetrics(registry: Registry, register = true) {
utilityWalletInsufficientBalance,
executorWalletsBalances,
executorWalletsMinBalance,
emittedOpEvents
emittedOpEvents,
walletsProcessingTime
}
}

0 comments on commit 0c1e874

Please sign in to comment.