feat: add prometheus monitor
This commit is contained in:
parent
253158beb9
commit
75b6943a2c
29
Cargo.lock
generated
29
Cargo.lock
generated
@ -1372,9 +1372,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nanobyte_opentelemetry"
|
||||
version = "0.2.3"
|
||||
version = "0.2.4"
|
||||
source = "sparse+https://git.nanobyte.cz/api/packages/nanobyte/cargo/"
|
||||
checksum = "053fac4ff7f3cab0a088383bc68774e402c07c92d19478bcbb51d1d49a5d42bf"
|
||||
checksum = "263d89ff6cdfa99d9dd3fa701db590f6f9abdc5a1f7498baa02d511d05689571"
|
||||
dependencies = [
|
||||
"gethostname",
|
||||
"opentelemetry",
|
||||
@ -1700,6 +1700,7 @@ dependencies = [
|
||||
"reqwest",
|
||||
"rocket",
|
||||
"rocket_dyn_templates",
|
||||
"rocket_prometheus",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_yaml",
|
||||
@ -1958,6 +1959,20 @@ dependencies = [
|
||||
"yansi 1.0.0-rc.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prometheus"
|
||||
version = "0.13.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "449811d15fbdf5ceb5c1144416066429cf82316e2ec8ce0c1f6f8a02e7bbcf8c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"fnv",
|
||||
"lazy_static",
|
||||
"memchr",
|
||||
"parking_lot",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prost"
|
||||
version = "0.11.9"
|
||||
@ -2282,6 +2297,16 @@ dependencies = [
|
||||
"uncased",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rocket_prometheus"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18faabccdfcd08d4501768f5b6936f6332af10496f1ea8107eb48a7766e03439"
|
||||
dependencies = [
|
||||
"prometheus",
|
||||
"rocket",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.23"
|
||||
|
@ -14,8 +14,9 @@ rocket = { version = "0.5.0", features = ["json"] }
|
||||
rocket_dyn_templates = { version = "0.1.0", features = ["tera"]}
|
||||
reqwest = { version = "0.11", features = ["json"] }
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
rocket_prometheus = "0.10.0"
|
||||
ovlach_data = { version = "0.1.3", registry = "gitea_ovlach"}
|
||||
nanobyte_opentelemetry = { version = "0.2.3", registry = "gitea_nanobyte", features = ["rocket-reqwest"] }
|
||||
nanobyte_opentelemetry = { version = "0.2.4", registry = "gitea_nanobyte", features = ["rocket-reqwest"] }
|
||||
chrono = "0.4.31"
|
||||
sha256 = "1.4.0"
|
||||
fluent-bundle = "0.15.2"
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user