import { type Context, type Exception, type Link, type Span, type SpanAttributes, type SpanAttributeValue, type SpanContext, type SpanOptions, type SpanStatus, type TimeInput, type Tracer } from "@opentelemetry/api"; import type { RemoteObject } from "../rpc.js"; import { type TelemetrySpanProtocol, type TelemetryTracerProtocol } from "./telemetry-protocol.js"; /** * Give this thread an async-local OTEL context manager unless one is already * registered, so `context.with(span)` nests the worker's spans. Idempotent. */ export declare function ensureWorkerContextManager(): void; /** * A main-thread span seen from a worker. Mutators are ordered notifications; * `spanContext()` and `isRecording()` answer from what main reported at start. */ export declare class RemoteSpan implements Span { #private; constructor(remote: RemoteObject); /** Seed the identity and recording state main reported when it started the span. */ prime(spanContext: SpanContext, recording: boolean): void; spanContext(): SpanContext; isRecording(): boolean; setAttribute(key: string, value: SpanAttributeValue): this; setAttributes(attributes: SpanAttributes): this; addEvent(name: string, attributesOrStartTime?: SpanAttributes | TimeInput, startTime?: TimeInput): this; addLink(link: Link): this; addLinks(links: Link[]): this; setStatus(status: SpanStatus): this; updateName(name: string): this; recordException(exception: Exception, time?: TimeInput): void; end(endTime?: TimeInput): void; } /** * A main-thread tracer seen from a worker: spans start on main (blocking, so * the returned span is real immediately), parented by the worker's active * context or, without one, by the context active when the run left main. */ export declare class RemoteTracer implements Tracer { #private; constructor(remote: RemoteObject); startSpan(name: string, options?: SpanOptions, ctx?: Context): Span; startActiveSpan(name: string, fn: (span: Span) => R): R; startActiveSpan(name: string, options: SpanOptions | undefined, fn: (span: Span) => R): R; startActiveSpan(name: string, options: SpanOptions | undefined, ctx: Context | undefined, fn: (span: Span) => R): R; }