diff --git a/docs/content/howto/monitoring-with-prometheus-and-grafana/index.md b/docs/content/howto/monitoring-with-prometheus-and-grafana/index.md index 4588e0e..296cbab 100644 --- a/docs/content/howto/monitoring-with-prometheus-and-grafana/index.md +++ b/docs/content/howto/monitoring-with-prometheus-and-grafana/index.md @@ -24,7 +24,7 @@ This will expose the following metrics on `http://127.0.0.1:42042/metrics`: iocaine_requests_total 1 # TYPE process_start_time_seconds gauge -process_start_time_seconds{instance="127.0.0.1:42042",service="iocaine"} 1738873005.2406795 +process_start_time_seconds{service="iocaine"} 1738873005.2406795 ``` The `process_start_time_seconds` metric is *always* present, and its value only changes when `iocaine` is restarted. For the sake of brevity, it is excluded from all other examples. diff --git a/src/app.rs b/src/app.rs index 4a305ed..137de28 100644 --- a/src/app.rs +++ b/src/app.rs @@ -162,16 +162,13 @@ impl Iocaine { #[cfg(feature = "prometheus")] async fn start_metrics_server(metrics_bind: String) -> std::result::Result<(), std::io::Error> { - let metrics_listener = tokio::net::TcpListener::bind(metrics_bind.clone()).await?; + let metrics_listener = tokio::net::TcpListener::bind(metrics_bind).await?; let app = Self::metrics_app().await; let ts = SystemTime::now() .duration_since(UNIX_EPOCH) .expect("Time went backwards"); - let labels = [ - ("instance", metrics_bind), - ("service", "iocaine".to_string()), - ]; + let labels = [("service", "iocaine".to_string())]; metrics::gauge!("process_start_time_seconds", &labels).set(ts); axum::serve(metrics_listener, app)