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::`.
25 lines
767 B
Rust
25 lines
767 B
Rust
//! 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;
|
||
}
|