diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-08-15 15:43:15 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-08-15 15:43:15 +0200 |
commit | 14163b5853aea4357f4e17bb341ccd50ba3c89f1 (patch) | |
tree | 99e07c959003e7eca95918119aeb57d5f33fe795 | |
parent | 2d439c388c03eaf36f0c8675df9cac57d08ff9f6 (diff) | |
download | garage-14163b5853aea4357f4e17bb341ccd50ba3c89f1.tar.gz garage-14163b5853aea4357f4e17bb341ccd50ba3c89f1.zip |
switch to ms, simplify collected metrics
-rw-r--r-- | src/db/metric_proxy.rs | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/db/metric_proxy.rs b/src/db/metric_proxy.rs index 469f8088..d246e7fe 100644 --- a/src/db/metric_proxy.rs +++ b/src/db/metric_proxy.rs @@ -16,8 +16,7 @@ use opentelemetry::{ pub struct MetricDbProxy { //@FIXME Replace with a template db: LmdbDb, - op_counter: Counter<u64>, - op_duration: ValueRecorder<f64>, + op: ValueRecorder<f64>, } impl MetricDbProxy { @@ -25,13 +24,9 @@ impl MetricDbProxy { let meter = global::meter("garage/web"); let s = Self { db, - op_counter: meter - .u64_counter("db.op_counter") - .with_description("Number of operations on the local metadata engine") - .init(), - op_duration: meter - .f64_value_recorder("db.op_duration") - .with_description("Duration of operations on the local metadata engine") + op: meter + .f64_value_recorder("db.op") + .with_description("Duration and amount of operations on the local metadata engine") .with_unit(Unit::new("ms")) .init(), }; @@ -50,7 +45,6 @@ impl MetricDbProxy { KeyValue::new("cat", cat), KeyValue::new("tx", tx), ]; - self.op_counter.add(1, &metric_tags); let request_start = Instant::now(); let res = fx(); @@ -58,7 +52,7 @@ impl MetricDbProxy { .saturating_duration_since(request_start) .as_nanos(); let delay_millis: f64 = delay_nanos as f64 / 1_000_000f64; - self.op_duration.record(delay_millis, &metric_tags); + self.op.record(delay_millis, &metric_tags); res } |