aboutsummaryrefslogtreecommitdiff
path: root/src/api/admin
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-09-20 17:45:18 +0200
committerAlex Auvolat <alex@adnab.me>2022-09-20 17:50:22 +0200
commit782630fc27b41b9ae58d1417cace2995c99856fc (patch)
tree56db83c31c53688c7c216cc425d1e2602e5ef1a4 /src/api/admin
parent7a901f7aab29d9ae09c378e3824b8236458f85f1 (diff)
downloadgarage-782630fc27b41b9ae58d1417cace2995c99856fc.tar.gz
garage-782630fc27b41b9ae58d1417cace2995c99856fc.zip
Initialize metrics exporter earlier (fix #389)fix-metrics
Diffstat (limited to 'src/api/admin')
-rw-r--r--src/api/admin/api_server.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/api/admin/api_server.rs b/src/api/admin/api_server.rs
index fb0078cc..0816bda1 100644
--- a/src/api/admin/api_server.rs
+++ b/src/api/admin/api_server.rs
@@ -34,7 +34,10 @@ pub struct AdminApiServer {
}
impl AdminApiServer {
- pub fn new(garage: Arc<Garage>) -> Self {
+ pub fn new(
+ garage: Arc<Garage>,
+ #[cfg(feature = "metrics")] exporter: PrometheusExporter,
+ ) -> Self {
let cfg = &garage.config.admin;
let metrics_token = cfg
.metrics_token
@@ -47,7 +50,7 @@ impl AdminApiServer {
Self {
garage,
#[cfg(feature = "metrics")]
- exporter: opentelemetry_prometheus::exporter().init(),
+ exporter,
metrics_token,
admin_token,
}