Skip to content
Français

ObservationHub

import type { ObservationHub } from "@elie-laloum/outpost";
  • scopeRequired
    ObservationScope
    Immutable correlation fields inherited by emissions from this hub.
  • errorsRequired
    readonly unknown[]
    Shared bounded collection of sink, serialization, overflow and timeout errors; retains the first 100 failures independently of execution.
  • droppedRequired
    number
    Shared count of delivery losses across sinks, including overflow and disabled receivers.
  • verboseRequired
    boolean
    Whether producers may emit full model request and response payloads; journal retention is configured separately.
  • emitRequired
    (source: ObservationSource, event: ObservationEvent) => void
    Stamps an event with seq, timestamp, source and this hub’s scope, then delivers a copy to inherited and local sinks. Does nothing after close(); sink failures go to errors, never thrown.
  • childRequired
    (scope: ObservationScope, sinks?: readonly ObservationSink[]) => ObservationHub
    Create a scoped child sharing sequence and delivery diagnostics, optionally adding sinks only for that child and its descendants.
  • flushRequired
    () => Promise<void>
    Drain the current delivery snapshot and flush registered sinks with bounded waits; later emissions belong to a later snapshot.
  • closeRequired
    () => Promise<void>
    Stop emissions from this child and its descendants, drain its delivery snapshot and detach its own sinks without closing caller-owned parent sinks.
export interface ObservationHub {
  readonly scope: ObservationScope;
  readonly errors: readonly unknown[];
  readonly dropped: number;
  readonly verbose: boolean;
  emit(source: ObservationSource, event: ObservationEvent): void;
  child(
    scope: ObservationScope,
    sinks?: readonly ObservationSink[],
  ): ObservationHub;
  flush(): Promise<void>;
  close(): Promise<void>;
}