19 lines
382 B
Rust
19 lines
382 B
Rust
use prometheus;
|
|
|
|
use crate::metrics::REGISTRY;
|
|
|
|
#[get("/metrics")]
|
|
pub async fn metrics() -> String {
|
|
let encoder = prometheus::TextEncoder::new();
|
|
let res_custom = encoder.encode_to_string(®ISTRY.gather());
|
|
|
|
match res_custom {
|
|
Ok(s) => s,
|
|
Err(e) => {
|
|
warn!("Error encoding metrics: {:?}", e);
|
|
|
|
String::new()
|
|
}
|
|
}
|
|
}
|