| 1 |
use axum::{extract::State, response::IntoResponse}; |
| 2 |
use metrics_exporter_prometheus::{PrometheusBuilder, PrometheusHandle}; |
| 3 |
|
| 4 |
pub fn init() -> PrometheusHandle { |
| 5 |
PrometheusBuilder::new() |
| 6 |
.install_recorder() |
| 7 |
.expect("install prometheus recorder") |
| 8 |
} |
| 9 |
|
| 10 |
pub async fn render(State(handle): State<PrometheusHandle>) -> impl IntoResponse { |
| 11 |
handle.render() |
| 12 |
} |
| 13 |
|