Emit `nodedb_cdc_events_dropped_total{tenant,stream}` labelled counters.
(&self, out: &mut String)
| 278 | |
| 279 | /// Emit `nodedb_cdc_events_dropped_total{tenant,stream}` labelled counters. |
| 280 | pub(super) fn prometheus_cdc_stream_drops(&self, out: &mut String) { |
| 281 | use std::fmt::Write as _; |
| 282 | let m = self |
| 283 | .cdc_events_dropped_by_stream |
| 284 | .read() |
| 285 | .unwrap_or_else(|p| p.into_inner()); |
| 286 | if m.is_empty() { |
| 287 | return; |
| 288 | } |
| 289 | let _ = out.write_str( |
| 290 | "# HELP nodedb_cdc_events_dropped_total CDC events dropped from stream buffers due to overflow\n\ |
| 291 | # TYPE nodedb_cdc_events_dropped_total counter\n", |
| 292 | ); |
| 293 | let mut pairs: Vec<_> = m.iter().collect(); |
| 294 | pairs.sort_by(|a, b| a.0.cmp(b.0)); |
| 295 | for ((tenant_id, stream_name), count) in pairs { |
| 296 | let _ = writeln!( |
| 297 | out, |
| 298 | r#"nodedb_cdc_events_dropped_total{{tenant="{tenant_id}",stream="{stream_name}"}} {count}"# |
| 299 | ); |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | /// Emit `nodedb_shutdown_phase_duration_seconds{phase}` gauges. |
| 304 | pub(super) fn prometheus_shutdown_phases(&self, out: &mut String) { |