/** * Low-cardinality telemetry contract for coordinator-owned realtime work. * * The values are per-item observations and every timing carries an explicit * denominator. Paths, causality IDs, area IDs, tenant IDs, and worker PIDs are * intentionally excluded: they belong in bounded diagnostic traces, never in * metric labels. */ export declare const REALTIME_TELEMETRY_EVENT = "sync.realtime.timing"; export declare const REALTIME_TELEMETRY_SCHEMA_VERSION = 3; export declare const REALTIME_TIMING_STAGES: readonly ["queue", "conflict", "worker", "operationGate", "appendLock", "network", "commit"]; export type RealtimeTimingStage = (typeof REALTIME_TIMING_STAGES)[number]; export type RealtimeTelemetrySource = "watcher" | "receiver" | "wake"; export type RealtimeTelemetryDirection = "push" | "pull"; export type RealtimeTelemetryOutcome = "durable" | "retryable" | "refused"; export declare const REALTIME_TELEMETRY_REASONS: readonly ["superseded", "stale-epoch", "admission-timeout", "drain-burst", "pass-exit", "unresolved-company", "shutdown"]; export type RealtimeTelemetryReason = (typeof REALTIME_TELEMETRY_REASONS)[number]; export type RealtimeTelemetryRecord = { event: typeof REALTIME_TELEMETRY_EVENT; schemaVersion: typeof REALTIME_TELEMETRY_SCHEMA_VERSION; source: RealtimeTelemetrySource; direction: RealtimeTelemetryDirection; outcome: RealtimeTelemetryOutcome; items: number; /** Active realtime workers at the point this pass entered the operation gate. */ occupancy: number; timingMs: Record; denominator: Record; /** Closed enum only — never a path, tenant, or causality id. */ reason?: RealtimeTelemetryReason; }; export type RealtimeTelemetrySink = (record: RealtimeTelemetryRecord) => void; export type RealtimeTelemetryClock = () => number; /** Reject dynamic dimensions before they can become a metric-key convention. */ export declare function assertRealtimeTelemetryLowCardinality(record: RealtimeTelemetryRecord): void; /** * A bridge executor currently exposes one composite sync pass. It marks all * seven contract stages around that pass so dashboards remain denominator-safe * while child workers gain finer internal probes. The stages are separately * named now, so that refinement does not change the published schema. */ export declare class RealtimeTelemetrySpan { private readonly source; private readonly direction; private readonly items; private readonly sink; private readonly now; private readonly startedAt; private readonly marks; private occupancy; constructor(source: RealtimeTelemetrySource, direction: RealtimeTelemetryDirection, items: number, sink: RealtimeTelemetrySink, now?: RealtimeTelemetryClock); mark(stage: RealtimeTimingStage): void; /** Records the bounded worker count after the guarded pass has been admitted. */ setOccupancy(occupancy: number): void; finish(outcome: RealtimeTelemetryOutcome, reason?: RealtimeTelemetryReason): RealtimeTelemetryRecord; } export declare function writeRealtimeTelemetryToStderr(record: RealtimeTelemetryRecord): void; //# sourceMappingURL=realtime-telemetry.d.ts.map