Skip to main content

llm_optimizer_processor/metrics/
mod.rs

1//! Prometheus metrics for the Stream Processor
2//!
3//! This module provides comprehensive metrics export for monitoring and observability
4//! of the stream processing system. All metrics follow Prometheus naming conventions
5//! and best practices.
6
7mod labels;
8mod prometheus;
9mod registry;
10mod server;
11
12pub use labels::{LabelSet, LabelValue, MetricLabels};
13pub use prometheus::{ProcessorMetrics, MetricsSnapshot};
14pub use registry::{MetricsRegistry, METRICS_REGISTRY};
15pub use server::{MetricsServer, MetricsServerConfig, HealthStatus};
16
17use thiserror::Error;
18
19/// Errors that can occur in the metrics subsystem
20#[derive(Error, Debug)]
21pub enum MetricsError {
22    #[error("Failed to start metrics server: {0}")]
23    ServerStartError(String),
24
25    #[error("Failed to bind to address {address}: {source}")]
26    BindError {
27        address: String,
28        source: std::io::Error,
29    },
30
31    #[error("Invalid metric label: {0}")]
32    InvalidLabel(String),
33
34    #[error("Metric registration failed: {0}")]
35    RegistrationError(String),
36
37    #[error("Metric encoding error: {0}")]
38    EncodingError(String),
39}
40
41pub type Result<T> = std::result::Result<T, MetricsError>;