From 5e96f88de5d386e78c48ef9ffb1a2337942f8800 Mon Sep 17 00:00:00 2001 From: Max Kalashnikoff Date: Mon, 13 Nov 2023 10:56:12 +0100 Subject: [PATCH] chore: making metrics name consistent --- src/metrics.rs | 16 ++++++++-------- src/services/publisher_service/mod.rs | 6 +++--- .../app/publishing_workers_count.libsonnet | 2 +- .../app/publishing_workers_errors.libsonnet | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/metrics.rs b/src/metrics.rs index 33f74874..7747a439 100644 --- a/src/metrics.rs +++ b/src/metrics.rs @@ -35,8 +35,8 @@ pub struct Metrics { pub processed_notifications: Counter, pub dispatched_notifications: Counter, pub notify_latency: Histogram, - pub spawned_publishing_workers: ObservableGauge, - pub publishing_worker_errors: Counter, + pub publishing_workers_count: ObservableGauge, + pub publishing_workers_errors: Counter, } impl Metrics { @@ -115,13 +115,13 @@ impl Metrics { .with_description("The amount of time it took to dispatch all notifications") .init(); - let spawned_publishing_workers = meter - .u64_observable_gauge("spawned_publishing_workers") + let publishing_workers_count = meter + .u64_observable_gauge("publishing_workers_count") .with_description("The number of spawned publishing workers tasks") .init(); - let publishing_worker_errors = meter - .u64_counter("publishing_worker_errors") + let publishing_workers_errors = meter + .u64_counter("publishing_workers_errors") .with_description("The number of publishing worker that ended with an error") .init(); @@ -140,8 +140,8 @@ impl Metrics { processed_notifications, dispatched_notifications, notify_latency, - spawned_publishing_workers, - publishing_worker_errors, + publishing_workers_count, + publishing_workers_errors, } } } diff --git a/src/services/publisher_service/mod.rs b/src/services/publisher_service/mod.rs index 832cdc80..33459916 100644 --- a/src/services/publisher_service/mod.rs +++ b/src/services/publisher_service/mod.rs @@ -119,7 +119,7 @@ async fn process_and_handle( let ctx = Context::current(); if let Some(metrics) = metrics { - metrics.spawned_publishing_workers.observe( + metrics.publishing_workers_count.observe( &ctx, spawned_tasks_counter.load(Ordering::SeqCst) as u64, &[], @@ -129,7 +129,7 @@ async fn process_and_handle( if let Err(e) = process_queued_messages(postgres, relay_http_client, metrics, analytics).await { if let Some(metrics) = metrics { - metrics.publishing_worker_errors.add(&ctx, 1, &[]); + metrics.publishing_workers_errors.add(&ctx, 1, &[]); } warn!("Error on processing queued messages by the worker: {:?}", e); } @@ -137,7 +137,7 @@ async fn process_and_handle( spawned_tasks_counter.fetch_sub(1, Ordering::SeqCst); if let Some(metrics) = metrics { - metrics.spawned_publishing_workers.observe( + metrics.publishing_workers_count.observe( &ctx, spawned_tasks_counter.load(Ordering::SeqCst) as u64, &[], diff --git a/terraform/monitoring/panels/app/publishing_workers_count.libsonnet b/terraform/monitoring/panels/app/publishing_workers_count.libsonnet index ac86537f..fa513235 100644 --- a/terraform/monitoring/panels/app/publishing_workers_count.libsonnet +++ b/terraform/monitoring/panels/app/publishing_workers_count.libsonnet @@ -13,7 +13,7 @@ local targets = grafana.targets; .configure(defaults.configuration.timeseries) .addTarget(targets.prometheus( datasource = ds.prometheus, - expr = 'sum(rate(spawned_publishing_workers_total{}[$__rate_interval]))', + expr = 'sum(rate(publishing_workers_count_total{}[$__rate_interval]))', refId = "availability", )) } diff --git a/terraform/monitoring/panels/app/publishing_workers_errors.libsonnet b/terraform/monitoring/panels/app/publishing_workers_errors.libsonnet index 3cc88381..dc5eb347 100644 --- a/terraform/monitoring/panels/app/publishing_workers_errors.libsonnet +++ b/terraform/monitoring/panels/app/publishing_workers_errors.libsonnet @@ -13,7 +13,7 @@ local targets = grafana.targets; .configure(defaults.configuration.timeseries) .addTarget(targets.prometheus( datasource = ds.prometheus, - expr = 'sum(rate(publishing_worker_errors_total{}[$__rate_interval]))', + expr = 'sum(rate(publishing_workers_errors_total{}[$__rate_interval]))', refId = "availability", )) }