import { Span } from '@opentelemetry/api'; export interface ITracingService { /** * Initializes the tracing service with the collector endpoint */ initialize(): void; /** * Starts a new span with the given name * @param name - Name of the span * @param attributes - Optional attributes to add to the span * @returns The created span */ startSpan(name: string, attributes?: Record): Span; /** * Ends a span * @param span - The span to end */ endSpan(span: Span): void; /** * Adds an event to a span * @param span - The span to add the event to * @param name - Name of the event * @param attributes - Optional attributes for the event */ addSpanEvent(span: Span, name: string, attributes?: Record): void; /** * Records an exception in a span * @param span - The span to record the exception in * @param error - The error to record */ recordException(span: Span, error: Error): void; /** * Sets an attribute on a span * @param span - The span to set the attribute on * @param key - Attribute key * @param value - Attribute value */ setSpanAttribute(span: Span, key: string, value: any): void; /** * Wraps a function with automatic span creation * @param name - Name of the span * @param fn - Function to wrap * @param attributes - Optional attributes */ trace(name: string, fn: () => T | Promise, attributes?: Record): Promise; /** * Flushes all pending spans to the collector * Call this when capture/process is complete */ flush(): Promise; /** * Cleans up resources */ cleanup(): void; /** * Set the session trace ID from external source (license or component prop) * @param traceId - The trace ID to use for all spans (32 hex characters) */ setSessionTraceId(traceId: string | null): void; /** * Get the current session trace ID */ getSessionTraceId(): string | null; }