mz_storage_operators/metrics.rs
1// Copyright Materialize, Inc. and contributors. All rights reserved.
2//
3// Use of this software is governed by the Business Source License
4// included in the LICENSE file.
5//
6// As of the Change Date specified in that file, in accordance with
7// the Business Source License, use of this software will be governed
8// by the Apache License, Version 2.0.
9
10//! Metrics for storage dataflow operators
11
12use std::sync::Arc;
13
14use mz_ore::metrics::{DeleteOnDropCounter, DeleteOnDropGauge};
15use prometheus::core::AtomicU64;
16
17/// Metrics used by the `backpressure` operator.
18#[derive(Debug, Clone)]
19pub struct BackpressureMetrics {
20 /// A counter with the number of emitted bytes.
21 pub emitted_bytes: Arc<DeleteOnDropCounter<AtomicU64, Vec<String>>>,
22 /// The last count of bytes we are waiting to be retired in the operator. This cannot
23 /// be directly compared to `retired_bytes`, but CAN indicate that backpressure is happening.
24 pub last_backpressured_bytes: Arc<DeleteOnDropGauge<AtomicU64, Vec<String>>>,
25 /// A counter with the number of bytes retired by downstream processing.
26 pub retired_bytes: Arc<DeleteOnDropCounter<AtomicU64, Vec<String>>>,
27}