This commit is contained in:
jude
2023-12-20 17:18:25 +00:00
parent 444c5dce33
commit fc3b3e08f1
2 changed files with 13 additions and 16 deletions

View File

@@ -1,5 +1,3 @@
use std::net::SocketAddr;
use axum::{routing::get, Router};
use lazy_static;
use log::warn;
@@ -26,12 +24,11 @@ pub fn init_metrics() {
pub async fn serve() {
let app = Router::new().route("/metrics", get(metrics));
let addr = SocketAddr::from(([127, 0, 0, 1], 31755));
axum::Server::bind(&addr)
.serve(app.into_make_service())
let listener = tokio::net::TcpListener::bind("localhost:31755")
.await
.unwrap();
axum::serve(listener, app).await.unwrap();
}
async fn metrics() -> String {