Skip to content

Commit 3a833a6

Browse files
authored
ref: add processor label to queue size metric (#232)
1 parent 99a847b commit 3a833a6

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

skynet/modules/monitoring.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@
5454
subsystem=PROMETHEUS_SUMMARIES_SUBSYSTEM,
5555
)
5656

57+
SUMMARY_QUEUE_SIZE_BY_PROCESSOR_METRIC = Gauge(
58+
'summary_queue_size_by_processor',
59+
documentation='Number of jobs in the queue per processor',
60+
namespace=PROMETHEUS_NAMESPACE,
61+
subsystem=PROMETHEUS_SUMMARIES_SUBSYSTEM,
62+
labelnames=['processor'],
63+
)
64+
5765
SUMMARY_ERROR_COUNTER = Counter(
5866
'summary_errors',
5967
documentation='Number of jobs that have failed',

skynet/modules/ttt/summaries/jobs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
SUMMARY_ERROR_COUNTER,
3434
SUMMARY_FULL_DURATION_METRIC,
3535
SUMMARY_INPUT_LENGTH_METRIC,
36+
SUMMARY_QUEUE_SIZE_BY_PROCESSOR_METRIC,
3637
SUMMARY_QUEUE_SIZE_METRIC,
3738
SUMMARY_TIME_IN_QUEUE_METRIC,
3839
)
@@ -117,6 +118,9 @@ async def update_summary_queue_metric() -> None:
117118
processor_queue_size = await db.llen(pending_key)
118119
total_queue_size += processor_queue_size
119120

121+
# Set individual processor queue size metric
122+
SUMMARY_QUEUE_SIZE_BY_PROCESSOR_METRIC.labels(processor=processor.value).set(processor_queue_size)
123+
120124
SUMMARY_QUEUE_SIZE_METRIC.set(total_queue_size)
121125

122126

0 commit comments

Comments
 (0)