Skip to content

Commit eb8596a

Browse files
committed
fmt.
1 parent 2ae49b5 commit eb8596a

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

util/tracing/src/simple_metrics.rs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,27 @@ use prometheus::{gather, Encoder, TextEncoder};
44
use tokio::task::JoinHandle;
55

66
/// Start a simple metrics server on the given hostname and port. This is for the usage other than the node.
7-
pub async fn start_metrics_server(listen_hostname: String, listen_port: u16) -> Result<JoinHandle<()>, anyhow::Error> {
8-
let bind_address = format!("{}:{}", listen_hostname, listen_port);
7+
pub async fn start_metrics_server(
8+
listen_hostname: String,
9+
listen_port: u16,
10+
) -> Result<JoinHandle<()>, anyhow::Error> {
11+
let bind_address = format!("{}:{}", listen_hostname, listen_port);
912

10-
let metrics_route = Route::new().at("/metrics", get(metrics_handler));
13+
let metrics_route = Route::new().at("/metrics", get(metrics_handler));
1114

12-
let server_handle = tokio::spawn(async move {
13-
let listener = TcpListener::bind(&bind_address);
14-
aptos_logger::info!("Starting Prometheus metrics server on http://{}/metrics", bind_address);
15+
let server_handle = tokio::spawn(async move {
16+
let listener = TcpListener::bind(&bind_address);
17+
aptos_logger::info!(
18+
"Starting Prometheus metrics server on http://{}/metrics",
19+
bind_address
20+
);
1521

16-
if let Err(e) = Server::new(listener).run(metrics_route).await {
17-
aptos_logger::error!("Metrics server error: {}", e);
18-
}
19-
});
22+
if let Err(e) = Server::new(listener).run(metrics_route).await {
23+
aptos_logger::error!("Metrics server error: {}", e);
24+
}
25+
});
2026

21-
Ok(server_handle)
27+
Ok(server_handle)
2228
}
2329

2430
#[handler]

0 commit comments

Comments
 (0)