diff options
author | Alex Auvolat <alex@adnab.me> | 2022-09-20 17:45:18 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-09-20 17:50:22 +0200 |
commit | 782630fc27b41b9ae58d1417cace2995c99856fc (patch) | |
tree | 56db83c31c53688c7c216cc425d1e2602e5ef1a4 /src/api/admin | |
parent | 7a901f7aab29d9ae09c378e3824b8236458f85f1 (diff) | |
download | garage-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.rs | 7 |
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, } |