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]]
|
[[package]]
|
||||||
name = "nanobyte_opentelemetry"
|
name = "nanobyte_opentelemetry"
|
||||||
version = "0.2.3"
|
version = "0.2.4"
|
||||||
source = "sparse+https://git.nanobyte.cz/api/packages/nanobyte/cargo/"
|
source = "sparse+https://git.nanobyte.cz/api/packages/nanobyte/cargo/"
|
||||||
checksum = "053fac4ff7f3cab0a088383bc68774e402c07c92d19478bcbb51d1d49a5d42bf"
|
checksum = "263d89ff6cdfa99d9dd3fa701db590f6f9abdc5a1f7498baa02d511d05689571"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gethostname",
|
"gethostname",
|
||||||
"opentelemetry",
|
"opentelemetry",
|
||||||
@ -1700,6 +1700,7 @@ dependencies = [
|
|||||||
"reqwest",
|
"reqwest",
|
||||||
"rocket",
|
"rocket",
|
||||||
"rocket_dyn_templates",
|
"rocket_dyn_templates",
|
||||||
|
"rocket_prometheus",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_yaml",
|
"serde_yaml",
|
||||||
@ -1958,6 +1959,20 @@ dependencies = [
|
|||||||
"yansi 1.0.0-rc.1",
|
"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]]
|
[[package]]
|
||||||
name = "prost"
|
name = "prost"
|
||||||
version = "0.11.9"
|
version = "0.11.9"
|
||||||
@ -2282,6 +2297,16 @@ dependencies = [
|
|||||||
"uncased",
|
"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]]
|
[[package]]
|
||||||
name = "rustc-demangle"
|
name = "rustc-demangle"
|
||||||
version = "0.1.23"
|
version = "0.1.23"
|
||||||
|
@ -14,8 +14,9 @@ rocket = { version = "0.5.0", features = ["json"] }
|
|||||||
rocket_dyn_templates = { version = "0.1.0", features = ["tera"]}
|
rocket_dyn_templates = { version = "0.1.0", features = ["tera"]}
|
||||||
reqwest = { version = "0.11", features = ["json"] }
|
reqwest = { version = "0.11", features = ["json"] }
|
||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
|
rocket_prometheus = "0.10.0"
|
||||||
ovlach_data = { version = "0.1.3", registry = "gitea_ovlach"}
|
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"
|
chrono = "0.4.31"
|
||||||
sha256 = "1.4.0"
|
sha256 = "1.4.0"
|
||||||
fluent-bundle = "0.15.2"
|
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 ovlach_tera::entity::lang_entity;
|
||||||
use rocket::{*, fairing::{AdHoc, Fairing}};
|
use rocket::{*, fairing::{AdHoc, Fairing}};
|
||||||
use rocket_dyn_templates::Template;
|
use rocket_dyn_templates::Template;
|
||||||
|
use rocket_prometheus::PrometheusMetrics;
|
||||||
use ::serde::{Deserialize, Serialize};
|
use ::serde::{Deserialize, Serialize};
|
||||||
use tools::tera::advanced_filter;
|
use tools::tera::advanced_filter;
|
||||||
|
|
||||||
@ -58,6 +59,8 @@ pub fn rocket_builder() -> Rocket<Build> {
|
|||||||
// extract the entire config any `Deserialize` value
|
// extract the entire config any `Deserialize` value
|
||||||
//let config: PresentationConfig = figment.extract().expect("config");
|
//let config: PresentationConfig = figment.extract().expect("config");
|
||||||
|
|
||||||
|
let prometheus = PrometheusMetrics::new();
|
||||||
|
|
||||||
rocket.attach(
|
rocket.attach(
|
||||||
template_fairing()
|
template_fairing()
|
||||||
).attach(
|
).attach(
|
||||||
@ -70,8 +73,12 @@ pub fn rocket_builder() -> Rocket<Build> {
|
|||||||
AdHoc::config::<FrontendSVCConfig>()
|
AdHoc::config::<FrontendSVCConfig>()
|
||||||
).attach(
|
).attach(
|
||||||
nanobyte_opentelemetry::rocket::TracingFairing::ignite()
|
nanobyte_opentelemetry::rocket::TracingFairing::ignite()
|
||||||
).mount("/", routes![
|
).attach(
|
||||||
|
prometheus.clone()
|
||||||
|
)
|
||||||
|
.mount("/", routes![
|
||||||
routes::root::index,
|
routes::root::index,
|
||||||
routes::root::index_without_lang
|
routes::root::index_without_lang
|
||||||
])
|
])
|
||||||
|
.mount("/metrics", prometheus)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user