diff options
author | Alex Auvolat <alex@adnab.me> | 2022-02-16 14:23:04 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-03-14 10:51:50 +0100 |
commit | 2cab84b1fe423a41b356211e592a614c95ec4e0c (patch) | |
tree | c7dc3227feccbd6f4a8aba0bf8025201f3acc229 /src/admin/metrics.rs | |
parent | 1e2cf26373ef1812a3152a0057774f6381e66914 (diff) | |
download | garage-2cab84b1fe423a41b356211e592a614c95ec4e0c.tar.gz garage-2cab84b1fe423a41b356211e592a614c95ec4e0c.zip |
Add many metrics in table/ and rpc/
Diffstat (limited to 'src/admin/metrics.rs')
-rw-r--r-- | src/admin/metrics.rs | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/admin/metrics.rs b/src/admin/metrics.rs index ccc26d26..44fd4cb2 100644 --- a/src/admin/metrics.rs +++ b/src/admin/metrics.rs @@ -3,11 +3,9 @@ use hyper::{ service::{make_service_fn, service_fn}, Body, Method, Request, Response, Server, }; -use lazy_static::lazy_static; use opentelemetry::{ global, metrics::{BoundCounter, BoundValueRecorder}, - KeyValue, }; use opentelemetry_prometheus::PrometheusExporter; use prometheus::{Encoder, TextEncoder}; @@ -19,11 +17,6 @@ use futures::future::*; use garage_model::garage::Garage; use garage_util::error::Error as GarageError; -lazy_static! { - // This defines the differennt tags that will be referenced by the object - static ref HANDLER_ALL: [KeyValue; 1] = [KeyValue::new("handler", "all")]; -} - // serve_req on metric endpoint async fn serve_req( req: Request<Body>, @@ -87,20 +80,20 @@ impl AdminServer { exporter, metrics: AdminServerMetrics { http_counter: meter - .u64_counter("router.http_requests_total") + .u64_counter("admin.http_requests_total") .with_description("Total number of HTTP requests made.") .init() - .bind(HANDLER_ALL.as_ref()), + .bind(&[]), http_body_gauge: meter - .u64_value_recorder("example.http_response_size_bytes") + .u64_value_recorder("admin.http_response_size_bytes") .with_description("The metrics HTTP response sizes in bytes.") .init() - .bind(HANDLER_ALL.as_ref()), + .bind(&[]), http_req_histogram: meter - .f64_value_recorder("example.http_request_duration_seconds") + .f64_value_recorder("admin.http_request_duration_seconds") .with_description("The HTTP request latencies in seconds.") .init() - .bind(HANDLER_ALL.as_ref()), + .bind(&[]), }, } } @@ -125,7 +118,7 @@ impl AdminServer { let addr = &garage.config.admin_api.bind_addr; - let server = Server::bind(&addr).serve(make_svc); + let server = Server::bind(addr).serve(make_svc); let graceful = server.with_graceful_shutdown(shutdown_signal); info!("Admin server listening on http://{}", addr); |