chore: add prometheus metrics

This commit is contained in:
Paul Makles
2023-07-04 17:52:40 +01:00
parent 815c3fe99e
commit 76150db293
10 changed files with 52 additions and 21 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "revolt-delta"
version = "0.6.4"
version = "0.6.5"
license = "AGPL-3.0-or-later"
authors = ["Paul Makles <paulmakles@gmail.com>"]
edition = "2018"
@@ -47,6 +47,7 @@ lettre = "0.10.0-alpha.4"
rocket = { version = "0.5.0-rc.2", default-features = false, features = ["json"] }
rocket_empty = { version = "0.1.1", features = ["schema"] }
rocket_authifier = { version = "1.0.7" }
rocket_prometheus = "0.10.0-rc.3"
# spec generation
schemars = "0.8.8"

View File

@@ -8,6 +8,7 @@ extern crate serde_json;
pub mod routes;
pub mod util;
use rocket_prometheus::PrometheusMetrics;
use std::net::Ipv4Addr;
use async_std::channel::unbounded;
@@ -65,7 +66,11 @@ async fn rocket() -> _ {
// Configure Rocket
let rocket = rocket::build();
let prometheus = PrometheusMetrics::new();
routes::mount(rocket)
.attach(prometheus.clone())
.mount("/metrics", prometheus)
.mount("/", revolt_quark::web::cors::catch_all_options_routes())
.mount("/", revolt_quark::web::ratelimiter::routes())
.mount("/swagger/", revolt_quark::web::swagger::routes())