fix(rustproxy metrics): use stable route metrics keys across HTTP and passthrough listeners

This commit is contained in:
2026-04-14 09:17:55 +00:00
parent 30e5ab308f
commit 6c5180573a
7 changed files with 89 additions and 15 deletions
@@ -639,7 +639,8 @@ impl HttpProxyService {
}
};
let route_id = route_match.route.id.as_deref();
let route_config_id = route_match.route.id.as_deref();
let route_id = route_match.route.metrics_key();
let ip_str = ip_string; // reuse from above (avoid redundant to_string())
self.metrics.record_http_request();
if let Some(ref h) = host {
@@ -654,7 +655,7 @@ impl HttpProxyService {
.as_ref()
.filter(|rl| rl.enabled)
.map(|rl| {
let route_key = route_id.unwrap_or("__default__").to_string();
let route_key = route_config_id.unwrap_or("__default__").to_string();
self.route_rate_limiters
.entry(route_key)
.or_insert_with(|| Arc::new(RateLimiter::new(rl.max_requests, rl.window)))