Hide metric for bad with no counter data
This commit is contained in:
parent
bd86ab8b52
commit
0c3142cc8f
@ -151,13 +151,17 @@ async fn route_metrics(
|
|||||||
let mut out = String::new();
|
let mut out = String::new();
|
||||||
|
|
||||||
for bad in trafficdata {
|
for bad in trafficdata {
|
||||||
|
let badcounter = match bad.counter {
|
||||||
|
Some(c) => c,
|
||||||
|
None => continue,
|
||||||
|
};
|
||||||
let badid = escape_metric_label_value(&bad.id);
|
let badid = escape_metric_label_value(&bad.id);
|
||||||
match state.baedernames.get(&bad.id) {
|
match state.baedernames.get(&bad.id) {
|
||||||
Some(name) => {
|
Some(name) => {
|
||||||
let badname = escape_metric_label_value(name);
|
let badname = escape_metric_label_value(name);
|
||||||
out.push_str(&format!("berlinerbaeder_occupation{{bad=\"{}\", badname=\"{}\"}} {}\n", badid, badname, bad.counter.unwrap_or(-1)))}
|
out.push_str(&format!("berlinerbaeder_occupation{{bad=\"{}\", badname=\"{}\"}} {}\n", badid, badname, badcounter))}
|
||||||
,
|
,
|
||||||
None => out.push_str(&format!("berlinerbaeder_occupation{{bad=\"{}\"}} {}\n", badid, bad.counter.unwrap_or(-1))),
|
None => out.push_str(&format!("berlinerbaeder_occupation{{bad=\"{}\"}} {}\n", badid, badcounter)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user