From 0a31f5f2e536297a32e87d454a6439ad00ae4372 Mon Sep 17 00:00:00 2001 From: Marco Neumann Date: Wed, 8 Sep 2021 14:16:47 +0200 Subject: [PATCH] fix: fix job metrics naming For duration historgrams, the exporter takes care of the correct suffix depending on the resolution used by it. For example the prometheus exporter will use a `..._seconds` metric to encode the historgram. The IOx internal metric should therefore NOT append any resolution. This then removes the `_nanoseconds` suffix, renaming the externally visible metric from ```text influxdb_iox_job_completed_{cpu,wall}_nanoseconds_seconds ``` to ```text influxdb_iox_job_completed_{cpu,wall}_seconds ``` --- server/src/job.rs | 8 ++++---- server/src/lib.rs | 12 ++++-------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/server/src/job.rs b/server/src/job.rs index 7d8d3b567c..41163186b6 100644 --- a/server/src/job.rs +++ b/server/src/job.rs @@ -107,12 +107,12 @@ impl JobRegistryMetrics { .register_metric("influxdb_iox_job_count", "Number of known jobs"), completed_accu: Default::default(), cpu_time_histogram: metric_registry_v2.register_metric( - "influxdb_iox_job_completed_cpu_nanoseconds", - "CPU time of of completed jobs in nanoseconds", + "influxdb_iox_job_completed_cpu", + "CPU time of of completed jobs", ), wall_time_histogram: metric_registry_v2.register_metric( - "influxdb_iox_job_completed_wall_nanoseconds", - "Wall time of of completed jobs in nanoseconds", + "influxdb_iox_job_completed_wall", + "Wall time of of completed jobs", ), completed_but_still_tracked: Default::default(), } diff --git a/server/src/lib.rs b/server/src/lib.rs index 38c9d11ae9..649041e236 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -2484,13 +2484,11 @@ mod tests { ); assert_eq!(observation, &metric::Observation::U64Gauge(1)); - // ========== influxdb_iox_job_completed_cpu_nanoseconds ========== + // ========== influxdb_iox_job_completed_cpu ========== let observations: Vec<_> = reporter .observations() .iter() - .filter(|observation| { - observation.metric_name == "influxdb_iox_job_completed_cpu_nanoseconds" - }) + .filter(|observation| observation.metric_name == "influxdb_iox_job_completed_cpu") .collect(); assert_eq!(observations.len(), 1); @@ -2507,13 +2505,11 @@ mod tests { ]) ); - // ========== influxdb_iox_job_completed_wall_nanoseconds ========== + // ========== influxdb_iox_job_completed_wall ========== let observations: Vec<_> = reporter .observations() .iter() - .filter(|observation| { - observation.metric_name == "influxdb_iox_job_completed_wall_nanoseconds" - }) + .filter(|observation| observation.metric_name == "influxdb_iox_job_completed_wall") .collect(); assert_eq!(observations.len(), 1);