(out: &mut String, name: &str, buckets: &[AtomicU64; 7])
| 276 | } |
| 277 | |
| 278 | fn append_histogram(out: &mut String, name: &str, buckets: &[AtomicU64; 7]) { |
| 279 | let boundaries = ["0.001", "0.005", "0.01", "0.05", "0.1", "0.5", "+Inf"]; |
| 280 | let mut cumulative = 0u64; |
| 281 | for (i, boundary) in boundaries.iter().enumerate() { |
| 282 | cumulative += buckets[i].load(Ordering::Relaxed); |
| 283 | out.push_str(&format!( |
| 284 | "{name}_bucket{{le=\"{boundary}\"}} {cumulative}\n" |
| 285 | )); |
| 286 | } |
| 287 | out.push_str(&format!("{name}_count {cumulative}\n")); |
| 288 | } |
| 289 | |
| 290 | #[cfg(test)] |
| 291 | mod tests { |
no test coverage detected