From bfac47ec1030957c5eafc7305851b8334dc6e63c Mon Sep 17 00:00:00 2001 From: Avram Tudor Date: Wed, 13 Nov 2024 14:28:11 +0200 Subject: [PATCH] fix: replace examplar usage with label for app_id --- skynet/modules/monitoring.py | 1 + skynet/modules/ttt/summaries/jobs.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/skynet/modules/monitoring.py b/skynet/modules/monitoring.py index 1f792bf..095ff5a 100644 --- a/skynet/modules/monitoring.py +++ b/skynet/modules/monitoring.py @@ -26,6 +26,7 @@ namespace=PROMETHEUS_NAMESPACE, subsystem=PROMETHEUS_SUMMARIES_SUBSYSTEM, buckets=[5**n for n in range(4)], + labelnames=['app_id'], ) SUMMARY_FULL_DURATION_METRIC = Histogram( diff --git a/skynet/modules/ttt/summaries/jobs.py b/skynet/modules/ttt/summaries/jobs.py index 50cf688..c33d122 100644 --- a/skynet/modules/ttt/summaries/jobs.py +++ b/skynet/modules/ttt/summaries/jobs.py @@ -169,7 +169,7 @@ async def update_done_job(job: Job, result: str, processor: Processors, has_fail await db.lrem(RUNNING_JOBS_KEY, 0, job.id) if updated_job.status != JobStatus.SKIPPED: - SUMMARY_DURATION_METRIC.observe(updated_job.computed_duration, {'app_id': updated_job.metadata.app_id}) + SUMMARY_DURATION_METRIC.labels(updated_job.metadata.app_id).observe(updated_job.computed_duration) SUMMARY_FULL_DURATION_METRIC.observe(updated_job.computed_full_duration) SUMMARY_INPUT_LENGTH_METRIC.observe(len(updated_job.payload.text))