Skip to content

Commit

Permalink
feat: add dummy /status probe in metrics' module (#94)
Browse files Browse the repository at this point in the history
* feat: add dummy /status probe in metrics' module

* fix: lint

* fix: address review comments
  • Loading branch information
aimxhaisse authored Aug 22, 2024
1 parent 624647a commit 0c12f37
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions crates/metrics/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ impl MetricsProvider {
pub async fn run(self) -> eyre::Result<()> {
info!("Starting metrics server on port {}", self.config.server_port);

let router =
axum::Router::new().route("/metrics", get(handle_metrics)).with_state(self.registry);
let router = axum::Router::new()
.route("/metrics", get(handle_metrics))
.route("/status", get(handle_status))
.with_state(self.registry);
let address = SocketAddr::from(([0, 0, 0, 0], self.config.server_port));
let listener = TcpListener::bind(&address).await?;

Expand All @@ -51,6 +53,12 @@ impl MetricsProvider {
}
}

async fn handle_status() -> Response {
trace!("Handling status request");

StatusCode::OK.into_response()
}

async fn handle_metrics(State(registry): State<Registry>) -> Response {
trace!("Handling metrics request");

Expand Down

0 comments on commit 0c12f37

Please sign in to comment.