aboutsummaryrefslogtreecommitdiff
path: root/src/admin
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-02-16 14:23:04 +0100
committerAlex Auvolat <alex@adnab.me>2022-03-14 10:51:50 +0100
commit2cab84b1fe423a41b356211e592a614c95ec4e0c (patch)
treec7dc3227feccbd6f4a8aba0bf8025201f3acc229 /src/admin
parent1e2cf26373ef1812a3152a0057774f6381e66914 (diff)
downloadgarage-2cab84b1fe423a41b356211e592a614c95ec4e0c.tar.gz
garage-2cab84b1fe423a41b356211e592a614c95ec4e0c.zip
Add many metrics in table/ and rpc/
Diffstat (limited to 'src/admin')
-rw-r--r--src/admin/Cargo.toml1
-rw-r--r--src/admin/lib.rs1
-rw-r--r--src/admin/metrics.rs21
3 files changed, 7 insertions, 16 deletions
diff --git a/src/admin/Cargo.toml b/src/admin/Cargo.toml
index 9775b667..6f646869 100644
--- a/src/admin/Cargo.toml
+++ b/src/admin/Cargo.toml
@@ -25,4 +25,3 @@ log = "0.4"
opentelemetry = "0.17"
opentelemetry-prometheus = "0.10"
prometheus = "0.13"
-lazy_static = "1.4"
diff --git a/src/admin/lib.rs b/src/admin/lib.rs
index 443361be..f1e8ddd7 100644
--- a/src/admin/lib.rs
+++ b/src/admin/lib.rs
@@ -1,6 +1,5 @@
//! Crate for handling the admin and metric HTTP APIs
#[macro_use]
extern crate log;
-extern crate lazy_static;
pub mod metrics;
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);