diff options
author | Alex Auvolat <alex@adnab.me> | 2022-02-22 13:53:59 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-03-14 10:53:35 +0100 |
commit | 818daa5c786813fdf50fecb6022e29b18e509b62 (patch) | |
tree | 5f4df9917e7939d7722daaafcbcebe4961ad1184 /src/admin | |
parent | f0d0cd9a20979f59db246e6a545ddc1b7bbb20b3 (diff) | |
download | garage-818daa5c786813fdf50fecb6022e29b18e509b62.tar.gz garage-818daa5c786813fdf50fecb6022e29b18e509b62.zip |
Refactor how durations are measured
Diffstat (limited to 'src/admin')
-rw-r--r-- | src/admin/Cargo.toml | 1 | ||||
-rw-r--r-- | src/admin/metrics.rs | 10 |
2 files changed, 4 insertions, 7 deletions
diff --git a/src/admin/Cargo.toml b/src/admin/Cargo.toml index b6bf2b3b..01c16c57 100644 --- a/src/admin/Cargo.toml +++ b/src/admin/Cargo.toml @@ -13,7 +13,6 @@ path = "lib.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -garage_model = { version = "0.6.0", path = "../model" } garage_util = { version = "0.6.0", path = "../util" } hex = "0.4" diff --git a/src/admin/metrics.rs b/src/admin/metrics.rs index e12373ab..64721af2 100644 --- a/src/admin/metrics.rs +++ b/src/admin/metrics.rs @@ -1,6 +1,7 @@ use std::convert::Infallible; use std::sync::Arc; use std::time::SystemTime; +use std::net::SocketAddr; use futures::future::*; use hyper::{ @@ -19,7 +20,6 @@ use opentelemetry_prometheus::PrometheusExporter; use prometheus::{Encoder, TextEncoder}; -use garage_model::garage::Garage; use garage_util::data::*; use garage_util::error::Error as GarageError; @@ -111,7 +111,7 @@ impl AdminServer { /// run execute the admin server on the designated HTTP port and listen for requests pub async fn run( self, - garage: Arc<Garage>, + bind_addr: SocketAddr, shutdown_signal: impl Future<Output = ()>, ) -> Result<(), GarageError> { let admin_server = Arc::new(self); @@ -142,11 +142,9 @@ impl AdminServer { } }); - let addr = &garage.config.admin_api.bind_addr; - - let server = Server::bind(addr).serve(make_svc); + let server = Server::bind(&bind_addr).serve(make_svc); let graceful = server.with_graceful_shutdown(shutdown_signal); - info!("Admin server listening on http://{}", addr); + info!("Admin server listening on http://{}", bind_addr); graceful.await?; Ok(()) |