Add request stats to instance info page

This commit is contained in:
Matthew Esposito 2023-05-31 19:39:44 -04:00
parent 193a6effbf
commit de68409610
No known key found for this signature in database
3 changed files with 13 additions and 1 deletions

View file

@ -23,7 +23,7 @@ use std::{
};
use time::Duration;
use crate::dbg_msg;
use crate::{dbg_msg, instance_info::INSTANCE_INFO};
type BoxResponse = Pin<Box<dyn Future<Output = Result<Response<Body>, String>> + Send>>;
@ -234,6 +234,8 @@ impl Server {
match router.recognize(&format!("/{}{}", req.method().as_str(), path)) {
// If a route was configured for this path
Ok(found) => {
// Add to total_requests count
INSTANCE_INFO.total_requests.fetch_add(1, std::sync::atomic::Ordering::SeqCst);
let mut parammed = req;
parammed.set_params(found.params().clone());