diff options
author | Vika <vika@fireburn.ru> | 2021-08-06 11:44:46 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2021-08-06 11:44:46 +0300 |
commit | 764d19570ceff8bd11d18ada3d2798f895da2da7 (patch) | |
tree | 1ddf223767089389f05c71cec12a952cbcf19980 /src/lib.rs | |
parent | 1c1d0e504c276ccb3c204aa28750f86610bff248 (diff) | |
download | kittybox-764d19570ceff8bd11d18ada3d2798f895da2da7.tar.zst |
Added Prometheus instrumentation
I need to instrument the mobc library used for the Redis connection pool, but that can be done later since I am somewhat tired. I don't remember how much I've worked and I need a break... >.<
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs index 6a62dcc..77a6c11 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,6 +4,7 @@ mod database; mod frontend; mod indieauth; mod micropub; +mod metrics; use crate::indieauth::IndieAuthMiddleware; use crate::micropub::CORSMiddleware; @@ -42,6 +43,7 @@ where .build()) }); app.at("/") + .with(CORSMiddleware {}) .with(frontend::ErrorHandlerMiddleware {}) .get(frontend::mainpage) .post(frontend::onboarding_receiver); @@ -54,7 +56,13 @@ where app.at("/coffee") .with(frontend::ErrorHandlerMiddleware {}) .get(frontend::coffee); + // TODO make sure the health check actually checks the backend or something + // otherwise it'll get false-negatives for application faults like resource + // exhaustion app.at("/health").get(|_| async { Ok("OK") }); + app.at("/metrics").get(metrics::gather); + + app.with(metrics::InstrumentationMiddleware {}); app } |