From 5d40086ecb30fe0fb7e1a490ead72c958012c5cd Mon Sep 17 00:00:00 2001 From: David Estes <5317198+dav1do@users.noreply.github.com> Date: Tue, 18 Jun 2024 15:39:14 -0600 Subject: [PATCH] chore: rename prometheus registry and metrics for better consistency (#373) * chore: all metrics under 'ceramic_one' prom registry * chore: rename store metrics was "ceramic_store_store_query_durations" and with the new c1 prefix "ceramic_one_ceramic_store_store_query_durations" and now "ceramic_one_store_query_durations" * chore: rename http_api_http_api metric http_api_info --- metrics/src/core.rs | 2 +- one/src/http_metrics.rs | 6 +----- store/src/metrics.rs | 10 +++++----- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/metrics/src/core.rs b/metrics/src/core.rs index bfe4cf0a2..6e00eb3c1 100644 --- a/metrics/src/core.rs +++ b/metrics/src/core.rs @@ -16,7 +16,7 @@ pub(crate) struct Core { impl Default for Core { fn default() -> Self { - let mut reg = Registry::default(); + let mut reg = Registry::with_prefix("ceramic_one"); Core { bitswap_metrics: bitswap::Metrics::new(&mut reg), libp2p_metrics: libp2p::metrics::Metrics::new(&mut reg), diff --git a/one/src/http_metrics.rs b/one/src/http_metrics.rs index 5804074b4..69012e606 100644 --- a/one/src/http_metrics.rs +++ b/one/src/http_metrics.rs @@ -62,11 +62,7 @@ impl Metrics { api_version: ceramic_api_server::API_VERSION, kubo_api_version: ceramic_kubo_rpc_server::API_VERSION, }); - sub_registry.register( - "http_api", - "Information about the Ceramic and Kubo APIs", - info, - ); + sub_registry.register("info", "Information about the Ceramic and Kubo APIs", info); Self { requests, diff --git a/store/src/metrics.rs b/store/src/metrics.rs index 18fbfbf78..f6db4292a 100644 --- a/store/src/metrics.rs +++ b/store/src/metrics.rs @@ -43,13 +43,13 @@ impl From<&StorageQuery> for QueryLabels { pub struct Metrics { key_value_insert_count: Counter, - store_query_durations: Family, + query_durations: Family, } impl Metrics { /// Register and construct Metrics pub fn register(registry: &mut Registry) -> Self { - let sub_registry = registry.sub_registry_with_prefix("ceramic_store"); + let sub_registry = registry.sub_registry_with_prefix("store"); register!( key_value_insert_count, @@ -59,7 +59,7 @@ impl Metrics { ); register!( - store_query_durations, + query_durations, "Durations of store queries in seconds", Family::::new_with_constructor(|| { Histogram::new(exponential_buckets(0.005, 2.0, 20)) @@ -69,7 +69,7 @@ impl Metrics { Self { key_value_insert_count, - store_query_durations, + query_durations, } } } @@ -83,7 +83,7 @@ impl Recorder for Metrics { impl Recorder for Metrics { fn record(&self, event: &StorageQuery) { let labels: QueryLabels = event.into(); - self.store_query_durations + self.query_durations .get_or_create(&labels) .observe(event.duration.as_secs_f64()); }