import type { CorrelationContext, EnabledProfilerLevel, ProcessRef, ProfilerValue } from "../schema"; import type { BootstrapProbe } from "./bootstrap-probe"; import { ProfilerClock } from "./clock"; import type { ProfilerRuntimeLike, ProfilerFragment, RuntimeSnapshot, SpanHandle, SpanOptions } from "./types"; export declare class ProfilerRuntime implements ProfilerRuntimeLike { readonly level: EnabledProfilerLevel; readonly runId: string; /** High-resolution monotonic clock value used as offset `0` for local elapsed-time measurements. */ readonly originMonotonicMs: number; /** Unix timestamp in milliseconds that corresponds to `originMonotonicMs`. */ readonly originEpochMs: number; private readonly _clock; private readonly _process; private readonly _operationIdPrefix; private readonly _context; private readonly _openSpans; private readonly _operations; private readonly _aggregates; private readonly _fragmentAggregates; private readonly _metrics; private readonly _fragmentMetrics; private readonly _errors; private _idSequence; private _stopped; private _overheadMs; private _sampler?; private _lastElu?; private readonly _transferredOperationIds; private _transferredErrorCount; private readonly _ingestedFragmentSequences; /** Out-of-order fragments waiting for a contiguous predecessor (RPC vs IPC race). */ private readonly _pendingFragments; private _pendingFragmentBytes; private readonly _externalTruncation; private readonly _asyncActivity?; private _eventLoopDelay?; private _lastHostCpu?; private _maxClockUncertaintyMs; private _unalignedFragments; private _aggregateIdentitiesSeen; private _aggregateIdentityOverflow; private _metricIdentitiesSeen; private _metricIdentityOverflow; private _fragmentSequence; private readonly _clockUncertaintyMs?; constructor(options: { runId: string; level: EnabledProfilerLevel; process?: ProcessRef; clock?: ProfilerClock; /** High-resolution monotonic clock value to use as offset `0`. */ originMonotonicMs?: number; /** Unix timestamp in milliseconds that corresponds to `originMonotonicMs`. */ originEpochMs?: number; /** Estimated maximum error when this runtime clock is aligned with another process. */ clockUncertaintyMs?: number; }); isEnabled(minLevel?: EnabledProfilerLevel): boolean; adoptBootstrapProbe(probe: BootstrapProbe): void; startSpan(kind: string, options?: SpanOptions): SpanHandle; withSpan(kind: string, options: SpanOptions, action: () => T): T; withContext(context: Partial, action: () => T): T; increment(metric: string, value?: number, dimensions?: Record): void; sample(metric: string, value: number, dimensions?: Record): void; recordError(stage: string, error: unknown): void; recordMeasurement(kind: string, durationMs: number, options?: SpanOptions, status?: "completed" | "failed" | "interrupted"): void; closeOpenSpans(): void; stop(): void; snapshot(): RuntimeSnapshot; takeFragment(): ProfilerFragment | null; ingestFragment(fragment: unknown): void; private _applyFragmentSafely; private _hasMatchingFragmentLevel; private _applyIngestedFragment; private _drainPendingFragments; private _reconcilePendingFragments; /** Apply buffered fragments for a source, recording transport.gap for any holes. */ private _forceApplyPendingFragments; private _takePendingFragment; private _endSpan; private _registerChildInterval; private _completeChildInterval; private _flushOpenChildIntervals; private _mergeChildInterval; private _recordOperation; private _addLocalAggregate; private _addAggregate; private _mergeAggregate; private _updateAggregate; private _updateMetric; private _startResourceSampler; private _recordResourceSample; private _snapshotAggregates; private _nextId; }