mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 04:04:43 +08:00
refactor(middleware): add middleware to record metrics for request count and duration (#7803)
This commit is contained in:
@ -10,7 +10,7 @@ use crate::{
|
||||
events::api_logs::ApiEventMetric,
|
||||
routes::{
|
||||
app::{AppStateInfo, ReqState},
|
||||
metrics, AppState, SessionState,
|
||||
AppState, SessionState,
|
||||
},
|
||||
services::{self, api, authentication as auth, logger},
|
||||
};
|
||||
@ -44,18 +44,15 @@ where
|
||||
let start_instant = Instant::now();
|
||||
logger::info!(tag = ?Tag::BeginRequest, payload = ?payload);
|
||||
|
||||
let server_wrap_util_res = metrics::request::record_request_time_metric(
|
||||
api::server_wrap_util(
|
||||
&flow,
|
||||
state.clone().into(),
|
||||
request.headers(),
|
||||
request,
|
||||
payload,
|
||||
func,
|
||||
api_authentication,
|
||||
lock_action,
|
||||
),
|
||||
let server_wrap_util_res = api::server_wrap_util(
|
||||
&flow,
|
||||
state.clone().into(),
|
||||
request.headers(),
|
||||
request,
|
||||
payload,
|
||||
func,
|
||||
api_authentication,
|
||||
lock_action,
|
||||
)
|
||||
.await
|
||||
.map(|response| {
|
||||
|
||||
Reference in New Issue
Block a user