Skip to main content

confluent_kafka/common/metrics/
mod.rs

1// Copyright 2025 Confluent Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! The Kafka metrics framework (`org.apache.kafka.common.metrics`).
16//!
17//! Faithful translation of the Java metrics core: same class names, file-per-
18//! class, identical metric values / names / recording-level gating. Java's
19//! `synchronized` is mapped to the minimal Rust atomic/lock equivalent (atomics
20//! for pure-counter stats, `Mutex` where multi-field mutation needs it). JMX is
21//! replaced by the [`MetricsReporter`] trait seam.
22
23mod compound_stat;
24pub mod gauge;
25pub(crate) mod internals;
26mod kafka_metric;
27mod measurable;
28mod measurable_stat;
29mod metric_config;
30pub mod metric_value_provider;
31#[expect(clippy::module_inception)]
32mod metrics;
33mod metrics_reporter;
34pub(crate) mod metrics_view;
35mod quota;
36mod quota_violation_error;
37pub mod sensor;
38mod stat;
39pub mod stats;
40mod time_unit;
41
42pub use compound_stat::{CompoundStat, NamedMeasurable};
43pub use gauge::Gauge;
44pub use kafka_metric::KafkaMetric;
45pub use measurable::{ClosureMeasurable, Measurable};
46pub use measurable_stat::MeasurableStat;
47pub use metric_config::MetricConfig;
48pub use metric_value_provider::MetricValueProvider;
49pub(crate) use metrics::MetricsShared;
50pub use metrics::{Metrics, SensorOptions, SensorOptionsBuilder};
51pub use metrics_reporter::MetricsReporter;
52pub use metrics_view::MetricsView;
53pub use quota::Quota;
54pub use quota_violation_error::QuotaViolationError;
55pub use sensor::{RecordingLevel, Sensor};
56pub use stat::Stat;
57pub use time_unit::TimeUnit;