swactor/crates/telemetry/src/health.rs
Zachery Aaron Shores-Chmielewski b3dbd7ce11 refactor: datastream crate is now telemetry
The crate is the per-node metrics/logging pipe with a universal
subscriber endpoint, but "datastream" kept getting misread as a general
messaging plane. Rename crate, module paths, and public API
(`DatastreamEndpoint` → `TelemetryEndpoint`, etc.) so misuse is visible
on sight.

Renamed contracts (all in-repo producers/consumers migrated):
- env vars `MYELIN_DATASTREAM_*` → `MYELIN_TELEMETRY_*`
- artifact `datastream.ndjson` → `telemetry.ndjson`
- actor names `telemetry-publisher` / `telemetry-sink`
- wire ALPN `swactor/telemetry/0`
- `DATASTREAM_SPEC.md` → `TELEMETRY_SPEC.md`

Also fixes two latent test breaks: `process` and `iroh-driver` tests
imported `DatastreamEvent` from the crate root, which was never
re-exported; they now use the observer path `telemetry::frame::`.
2026-08-15 12:18:56 +04:00

25 lines
767 B
Rust
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//! Telemetry-owned self-health record.
use serde::{Deserialize, Serialize};
use crate::record::Record;
/// Telemetry self-health — the mux's own integrity counters.
pub const TELEMETRY_HEALTH: &str = "telemetry.health";
/// `assigned` is the gap-free high-water mark (every position handed out);
/// `dropped` is the frames lost to mux overflow.
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
pub struct TelemetryHealth {
#[serde(default)]
pub assigned: u64,
#[serde(default)]
pub dropped: u64,
/// `dropped / assigned × 1_000_000`; `0` when nothing has been assigned yet.
#[serde(default)]
pub loss_rate_ppm: u32,
}
impl Record for TelemetryHealth {
const CHANNEL: &'static str = TELEMETRY_HEALTH;
}