Skip to content
1 min read · 179 words

Function: emitIsolationReport()

ts
function emitIsolationReport(
  hooks: IsolationObservabilityHooks | undefined,
  phase: IsolationReportPhase,
  base: {
    serviceName?: string;
    spawnCount: number;
  },
  extra?: Omit<
    Partial<IsolationReport>,
    "at" | "phase" | "serviceName" | "spawnCount"
  >,
  now?: () => string,
): void;

Defined in: src/batteries/isolation/observability.ts:201

Build an IsolationReport (stamping at) and dispatch it to the firehose (IsolationObservabilityHooks.onIsolation) AND the per-phase-group hook for phase. A no-op when hooks is undefined or carries no relevant callbacks — callers should additionally guard expensive extra computation (e.g. approxBytes sizing) behind hasIsolationHook so it is never computed when unhooked. Each callback is invoked through safeInvoke, so a throwing consumer never disrupts the battery.

Parameters

ParameterTypeDescription
hooks| IsolationObservabilityHooks | undefinedThe isolation observability hooks (may be undefined).
phaseIsolationReportPhaseThe phase being reported.
base{ serviceName?: string; spawnCount: number; }serviceName + spawnCount, common to every report.
base.serviceName?string-
base.spawnCount?number-
extra?Omit<Partial<IsolationReport>, "at" | "phase" | "serviceName" | "spawnCount">Phase-specific fields (see IsolationReport).
now?() => stringInjectable clock for tests; defaults to new Date().toISOString().

Returns

void