init
This commit is contained in:
@@ -23,6 +23,8 @@ use std::sync::atomic::{AtomicU64, Ordering};
|
||||
use std::sync::Arc;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use crate::metrics::{Metrics, MetricsSnapshot};
|
||||
|
||||
// ── Compteurs ────────────────────────────────────────────────────────────────
|
||||
|
||||
/// Compteurs atomiques du serveur HTTP.
|
||||
@@ -99,6 +101,14 @@ impl HttpMetrics {
|
||||
}
|
||||
}
|
||||
|
||||
impl Metrics for HttpMetrics {
|
||||
type Snapshot = HttpMetricsSnapshot;
|
||||
|
||||
fn snapshot(&self) -> HttpMetricsSnapshot {
|
||||
self.snapshot()
|
||||
}
|
||||
}
|
||||
|
||||
// ── Snapshot ─────────────────────────────────────────────────────────────────
|
||||
|
||||
/// Lecture cohérente des compteurs à un instant T.
|
||||
@@ -148,6 +158,12 @@ impl HttpMetricsSnapshot {
|
||||
}
|
||||
}
|
||||
|
||||
impl MetricsSnapshot for HttpMetricsSnapshot {
|
||||
fn taken_at(&self) -> Instant {
|
||||
self.taken_at
|
||||
}
|
||||
}
|
||||
|
||||
// ── Taux ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
/// Taux moyens par seconde calculés entre deux snapshots.
|
||||
|
||||
Reference in New Issue
Block a user