feat(router_env): making metric flow as a trait for extensibility (#797)

This commit is contained in:
Nishant Joshi
2023-03-23 14:52:57 +05:30
committed by GitHub
parent 699ca4f6f8
commit da5a89bc3d
3 changed files with 11 additions and 2 deletions

View File

@ -1,6 +1,9 @@
use super::utils as metric_utils;
pub async fn record_request_time_metric<F, R>(future: F, flow: router_env::Flow) -> R
pub async fn record_request_time_metric<F, R>(
future: F,
flow: impl router_env::types::FlowMetric,
) -> R
where
F: futures::Future<Output = R>,
{

View File

@ -522,7 +522,7 @@ where
fields(request_method, request_url_path)
)]
pub async fn server_wrap<'a, 'b, A, T, U, Q, F, Fut, E>(
flow: router_env::Flow,
flow: impl router_env::types::FlowMetric,
state: &'b A,
request: &'a HttpRequest,
payload: T,