Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions servers/cu/src/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,15 @@ export const createApis = async (ctx) => {
labelNames: ['stream_type', 'message_type', 'process_error']
})

const pendingEvaluationCounter = MetricsClient.counterWith({})({
name: 'ao_process_pending_evaluations',
description: 'The total number of pending evaluations on a CU',
labelNames: ['type']
})

pendingEvaluationCounter.set({ type: 'primary' }, primaryWorkQueue.size)
Copy link
Contributor

@jfrain99 jfrain99 Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will set the metric amount when this file is run at startup, then never again. We will need to move the sets to the location that the work queues are added to (evaluateWith, maybe?) and increment it by 1 on addition and decrement by 1 on completion.

set does not currently exist on the grafana counters. Only inc is implemented (see effects/metrics.js, counterWith). This can be implemented with inc / dec or feel free to implement set in metrics.js - up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, will adjust this accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jfrain99 Seems there is a way to listen to events on the PQueue and accordingly inc, dec the pendingEvaluationsCounter given those events take place. I've added this accordingly. Not so familiar with JS, so let me know if I need to change further.

pendingEvaluationCounter.set({ type: 'dry-run' }, dryRunWorkQueue.size)

/**
* TODO: Gas can grow to a huge number. We need to make sure this doesn't crash when that happens
*/
Expand Down
Loading