import { SpanData } from './span-data'; import { TracingProcessor } from './processor-interface'; /** * Error information for a span */ export declare class SpanError { message: string; data: Record | null; constructor(params: { message: string; data: Record | null; }); } /** * Base abstract interface for spans */ export declare abstract class Span { /** * The trace ID of the span */ abstract get traceId(): string; /** * The span ID */ abstract get spanId(): string; /** * The span data */ abstract get spanData(): TSpanData; /** * The parent span ID, if any */ abstract get parentId(): string | null; /** * Start the span * @param markAsCurrent - Whether to mark this span as the current span */ abstract start(markAsCurrent?: boolean): void; /** * Finish the span * @param resetCurrent - Whether to reset the current span */ abstract finish(resetCurrent?: boolean): void; /** * Set an error on the span * @param error - The error information */ abstract setError(error: SpanError): void; /** * Get the error on the span, if any */ abstract get error(): SpanError | null; /** * Export the span as a plain object */ abstract export(): Record | null; /** * The time the span was started, as an ISO string */ abstract get startedAt(): string | null; /** * The time the span was ended, as an ISO string */ abstract get endedAt(): string | null; /** * Use the span as a context manager */ abstract __enter__(): Span; /** * Exit the context manager */ abstract __exit__(excType: any, excVal: any, excTb: any): void; } /** * No-op implementation of a span */ export declare class NoOpSpan implements Span { private _spanData; private _prevSpanToken; constructor(spanData: TSpanData); get traceId(): string; get spanId(): string; get spanData(): TSpanData; get parentId(): string | null; start(markAsCurrent?: boolean): void; finish(resetCurrent?: boolean): void; __enter__(): Span; __exit__(excType: any, excVal: any, excTb: any): void; setError(error: SpanError): void; get error(): SpanError | null; export(): Record | null; get startedAt(): string | null; get endedAt(): string | null; } /** * Implementation of a span */ export declare class SpanImpl implements Span { private _traceId; private _spanId; private _parentId; private _startedAt; private _endedAt; private _error; private _prevSpanToken; private _processor; private _spanData; constructor(traceId: string, spanId: string | null, parentId: string | null, processor: TracingProcessor, spanData: TSpanData); get traceId(): string; get spanId(): string; get spanData(): TSpanData; get parentId(): string | null; start(markAsCurrent?: boolean): void; finish(resetCurrent?: boolean): void; __enter__(): Span; __exit__(excType: any, excVal: any, excTb: any): void; setError(error: SpanError): void; get error(): SpanError | null; get startedAt(): string | null; get endedAt(): string | null; export(): Record | null; }