import { ITracingService } from './interfaces/ITracingService'; import { Span } from '@opentelemetry/api'; export interface TracingConfig { collectorUrl?: string; serviceName?: string; serviceVersion?: string; debug?: boolean; customerId?: string; tenantId?: string; environment?: string; propagateTraceHeaderCorsUrls?: (string | RegExp)[]; enableAutoInstrumentation?: boolean; } export declare class TracingService implements ITracingService { private provider; private tracer; private sessionTraceId; private readonly collectorUrl; private readonly serviceName; private readonly serviceVersion; private readonly debug; private readonly customerId?; private readonly tenantId?; private readonly environment?; private readonly enableAutoInstrumentation; private spanProcessor; private parser; private geoCache; private geoCacheTimestamp; private readonly GEO_CACHE_DURATION_MS; constructor(config?: TracingConfig); initialize(): void; private initializeAutoInstrumentation; private getDeviceInfo; private getBrowserInfo; private getOSInfo; /** * 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; /** * Generate a random span ID (16 hex characters) */ private generateSpanId; private getGeoLocation; startSpan(name: string, attributes?: Record): Span; endSpan(span: Span): void; addSpanEvent(span: Span, name: string, attributes?: Record): void; recordException(span: Span, error: Error): void; setSpanAttribute(span: Span, key: string, value: any): void; trace(name: string, fn: () => T | Promise, attributes?: Record): Promise; traceAsync(name: string, fn: () => Promise, attributes?: Record): Promise; /** * Flush all pending spans to the collector * Call this when capture/process is complete to send all traces */ flush(): Promise; cleanup(): Promise; /** * Get the current trace ID (useful for logging correlation) */ getCurrentTraceId(): string | undefined; /** * Get the current span ID */ getCurrentSpanId(): string | undefined; }