MCPcopy Create free account
hub / github.com/envoyproxy/dynamic-modules-examples / record_latency

Method record_latency

rust/src/http_metrics.rs:63–77  ·  view source on GitHub ↗

This records the latency of the request. Note that it uses the handle to the histogram vector that was allocated at filter config creation time.

(&mut self, envoy_filter: &mut EHF)

Source from the content-addressed store, hash-verified

61impl Filter {
62 /// This records the latency of the request. Note that it uses the handle to the histogram vector that was allocated at filter config creation time.
63 fn record_latency<EHF: EnvoyHttpFilter>(&mut self, envoy_filter: &mut EHF) {
64 let Some(start_time) = self.start_time else {
65 return;
66 };
67 let Some(route_name) = self.route_name.take() else {
68 return;
69 };
70 envoy_filter
71 .record_histogram_value_vec(
72 self.route_latency,
73 &[&self.version, &route_name],
74 start_time.elapsed().as_millis() as u64,
75 )
76 .unwrap();
77 }
78}
79
80/// This implements the [`envoy_proxy_dynamic_modules_rust_sdk::HttpFilter`] trait.

Callers 3

on_response_headersMethod · 0.80
on_response_bodyMethod · 0.80
on_request_trailersMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected