add requests_received metrics
Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
This commit is contained in:
parent
7e31f167ea
commit
5c0d12cafe
1 changed files with 12 additions and 0 deletions
12
src/main.rs
12
src/main.rs
|
@ -98,12 +98,24 @@ fn main() {
|
|||
&["status", "postprocess"],
|
||||
)
|
||||
.expect("Failed to create prometheus counter");
|
||||
let counter_requests_received = GenericCounterVec::<AtomicU64>::new(
|
||||
Opts::new(
|
||||
"misskey_media_proxy_requests_received",
|
||||
"Number of requests received",
|
||||
),
|
||||
&[],
|
||||
)
|
||||
.expect("Failed to create prometheus counter");
|
||||
|
||||
reg.register(Box::new(counter_requests_served.clone()))
|
||||
.expect("Failed to register prometheus counter");
|
||||
|
||||
reg.register(Box::new(counter_requests_received.clone()))
|
||||
.expect("Failed to register prometheus counter");
|
||||
|
||||
router = router
|
||||
.layer(middleware::from_fn(move |req, mut next: Next| {
|
||||
counter_requests_received.with_label_values(&[]).inc();
|
||||
let counter_requests_served = counter_requests_served.clone();
|
||||
next.call(req)
|
||||
.map_ok(move |res| {
|
||||
|
|
Loading…
Reference in a new issue