feat: add prometheus monitor

This commit is contained in:
2023-12-10 19:05:40 +01:00
parent 253158beb9
commit 75b6943a2c
3 changed files with 37 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ use nanobyte_tera::{hosts::static_filter, l18n::translate_filter, date::{calcula
use ovlach_tera::entity::lang_entity;
use rocket::{*, fairing::{AdHoc, Fairing}};
use rocket_dyn_templates::Template;
use rocket_prometheus::PrometheusMetrics;
use ::serde::{Deserialize, Serialize};
use tools::tera::advanced_filter;
@@ -58,6 +59,8 @@ pub fn rocket_builder() -> Rocket<Build> {
// extract the entire config any `Deserialize` value
//let config: PresentationConfig = figment.extract().expect("config");
let prometheus = PrometheusMetrics::new();
rocket.attach(
template_fairing()
).attach(
@@ -70,8 +73,12 @@ pub fn rocket_builder() -> Rocket<Build> {
AdHoc::config::<FrontendSVCConfig>()
).attach(
nanobyte_opentelemetry::rocket::TracingFairing::ignite()
).mount("/", routes![
).attach(
prometheus.clone()
)
.mount("/", routes![
routes::root::index,
routes::root::index_without_lang
])
.mount("/metrics", prometheus)
}