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))