Skip to main content

Module streaming

Module streaming 

Source
Expand description

Real-Time Metric Streaming

Provides callback-based real-time streaming of observability metrics for live monitoring, alerting, and reactive systems.

§Features

  • Callback-based metric updates
  • Threshold-based alerting
  • Metric change detection
  • Rate limiting for high-frequency metrics
  • Multiple subscriber support

§Usage

use embeddenator_obs::streaming::{MetricStream, MetricEvent};

let mut stream = MetricStream::new();

// Subscribe to metric updates
stream.subscribe(|event| {
    match event {
        MetricEvent::Counter(name, value) => {
            println!("Counter {}: {}", name, value);
        }
        MetricEvent::Gauge(name, value) => {
            if value > 100.0 {
                alert!("High gauge value");
            }
        }
        _ => {}
    }
});

// Publish metrics
stream.publish_counter("requests", 42);
stream.publish_gauge("cpu_usage", 75.5);

Structs§

MetricStream
Real-time metric streaming system.
ThresholdAlert
Threshold-based alert configuration.

Enums§

MetricEvent
Type of metric event.

Type Aliases§

MetricCallback
Metric subscriber callback.