Module Algostream_telemetry.Snapshot

The immutable aggregate a monitoring client reads.

Built on demand by Algostream_telemetry.Collector.snapshot. Every field is a plain value, so the record can be handed across Domains and serialized without further coordination.

type latency = {
  1. end_to_end : Histogram.summary;
    (*

    Publish to delivery, measured by the collector's own bus subscription. This is where the p50/p99/p99.9 figures come from — the bus's own Instrumentation tracks only count, avg, max and violations.

    *)
  2. sla_ns : int64;
  3. sla_violations : int64;
    (*

    samples at or above sla_ns

    *)
  4. sla_violation_pct : float;
}
type bus = {
  1. depth : int;
  2. depth_per_band : int array;
    (*

    indexed by Priority.to_int; a band near capacity is about to start dropping

    *)
  3. subscriber_count : int;
  4. published : int64;
  5. dropped : int64;
  6. dropped_per_band : int64 array;
  7. dispatched : int64;
  8. handler_errors : int64;
  9. events_per_sec : float;
    (*

    derived between consecutive snapshots; 0.0 for the first

    *)
}
type component = {
  1. name : string;
  2. metrics : (string * float) list;
  3. status : Health.status;
}

A subsystem that registered itself with the collector. Metrics are name/value pairs rather than a closed record so that algostream.telemetry need not depend on ingestion, the processors or the runtime — it is handed closures instead. This follows the precedent set by Performance.Metrics.to_assoc.

type t = {
  1. ts_ns : int64;
    (*

    monotonic, matching event timestamps

    *)
  2. wall_ns : int64;
    (*

    realtime, for display

    *)
  3. uptime_ns : int64;
  4. latency : latency;
  5. bus : bus;
  6. components : component list;
  7. health : Health.report list;
  8. overall : Health.status;
  9. alerts : Alert.t list;
}
val to_assoc : t -> (string * float) list

Flat name/value view of the numeric fields, for a generic metrics table or a quick export. Component metrics are prefixed with the component name.

val to_string : t -> string