mirror of
https://github.com/redlib-org/redlib.git
synced 2025-06-07 23:27:51 +00:00
Add request stats to instance info page
This commit is contained in:
parent
193a6effbf
commit
de68409610
3 changed files with 13 additions and 1 deletions
|
@ -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());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue