diff options
Diffstat (limited to 'src/proxy_config.rs')
-rw-r--r-- | src/proxy_config.rs | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/proxy_config.rs b/src/proxy_config.rs index 24ade8b..2ce462e 100644 --- a/src/proxy_config.rs +++ b/src/proxy_config.rs @@ -189,7 +189,7 @@ fn parse_consul_catalog( let mut entries = vec![]; - for (service_name, svc) in catalog.services.iter() { + for (_, svc) in catalog.services.iter() { let ip_addr = match svc.address.parse() { Ok(ip) => ip, _ => match catalog.node.address.parse() { @@ -222,7 +222,7 @@ fn parse_consul_catalog( for tag in svc.tags.iter() { if let Some(ent) = parse_tricot_tag( - service_name.clone(), + svc.service.clone(), tag, addr, &add_headers[..], @@ -388,15 +388,22 @@ impl ProxyConfigMetrics { .u64_value_observer("proxy_config_entries", move |observer| { let mut patterns = HashMap::new(); for ent in rx.borrow().entries.iter() { - let pat = format!( - "{}{}", - ent.host, - ent.path_prefix.as_deref().unwrap_or_default() + let attrs = ( + ent.host.to_string(), + ent.path_prefix.clone().unwrap_or_default(), + ent.service_name.clone(), ); - *patterns.entry(pat).or_default() += 1; + *patterns.entry(attrs).or_default() += 1; } - for (pat, num) in patterns { - observer.observe(num, &[KeyValue::new("host", pat)]); + for ((host, prefix, svc), num) in patterns { + observer.observe( + num, + &[ + KeyValue::new("host", host), + KeyValue::new("path_prefix", prefix), + KeyValue::new("service", svc), + ], + ); } }) .with_description("Number of proxy entries (back-ends) configured in Tricot") |