Properly format metrics on missing badname
This commit is contained in:
parent
72fc8fb588
commit
011fbdd2b7
@ -143,7 +143,10 @@ async fn route_metrics(
|
|||||||
let mut out = String::new();
|
let mut out = String::new();
|
||||||
|
|
||||||
for bad in trafficdata {
|
for bad in trafficdata {
|
||||||
out.push_str(&format!("berlinerbaeder_occupation{{bad=\"{}\" badname=\"{}\"}} {}\n", bad.id, state.baedernames.get(&bad.id).unwrap_or(&String::new()), bad.counter.unwrap_or(-1)));
|
match state.baedernames.get(&bad.id) {
|
||||||
|
Some(name) => out.push_str(&format!("berlinerbaeder_occupation{{bad=\"{}\", badname=\"{}\"}} {}\n", bad.id, name, bad.counter.unwrap_or(-1))),
|
||||||
|
None => out.push_str(&format!("berlinerbaeder_occupation{{bad=\"{}\"}} {}\n", bad.id, bad.counter.unwrap_or(-1))),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(out);
|
return Ok(out);
|
||||||
|
Loading…
Reference in New Issue
Block a user