use crate::domain::entities::{Counter, Gauge, Histogram};
pub trait CliPort {
fn display_counter(&self, counter: &Counter);
fn display_gauge(&self, gauge: &Gauge);
fn display_histogram(&self, histogram: &Histogram);
fn display_error(&self, error: &str);
fn display_snapshot(&self, snapshot: &MetricsSnapshot);
}
#[derive(Debug, Clone, Default)]
pub struct MetricsSnapshot {
pub counters: Vec<CounterSnapshot>,
pub gauges: Vec<GaugeSnapshot>,
}
#[derive(Debug, Clone)]
pub struct CounterSnapshot {
pub name: String,
pub value: u64,
}
#[derive(Debug, Clone)]
pub struct GaugeSnapshot {
pub name: String,
pub value: f64,
}
pub trait HttpPort {
fn handle_get_metrics(&self) -> MetricsSnapshot;
fn handle_inc_counter(&self, name: &str, delta: u64) -> Result<(), String>;
fn handle_set_gauge(&self, name: &str, value: f64) -> Result<(), String>;
fn handle_record_histogram(&self, name: &str, value: u64) -> Result<(), String>;
}