QoL
* Made todo added responses ephemeral if /settings ephemeral is on * Enabled systemd watchdog * Move metrics to rocket
This commit is contained in:
@ -1,6 +1,4 @@
|
||||
use axum::{routing::get, Router};
|
||||
use lazy_static::lazy_static;
|
||||
use log::warn;
|
||||
use prometheus::{IntCounterVec, Opts, Registry};
|
||||
|
||||
lazy_static! {
|
||||
@ -26,21 +24,3 @@ pub fn init_metrics() {
|
||||
REGISTRY.register(Box::new(REMINDER_FAIL_COUNTER.clone())).unwrap();
|
||||
REGISTRY.register(Box::new(COMMAND_COUNTER.clone())).unwrap();
|
||||
}
|
||||
|
||||
pub async fn serve() {
|
||||
let app = Router::new().route("/metrics", get(metrics));
|
||||
|
||||
let listener = tokio::net::TcpListener::bind("localhost:31756").await.unwrap();
|
||||
axum::serve(listener, app).await.unwrap();
|
||||
}
|
||||
|
||||
async fn metrics() -> String {
|
||||
let encoder = prometheus::TextEncoder::new();
|
||||
let res_custom = encoder.encode_to_string(®ISTRY.gather());
|
||||
|
||||
res_custom.unwrap_or_else(|e| {
|
||||
warn!("Error encoding metrics: {:?}", e);
|
||||
|
||||
String::new()
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user