/**
 * OpenTelemetry Tracing Service
 *
 * Provides distributed tracing for the Crewly backend using OpenTelemetry.
 * Configurable via environment variables:
 *   - OTEL_ENABLED: 'true' to enable tracing (default: disabled)
 *   - OTEL_EXPORTER_ENDPOINT: OTLP HTTP endpoint (default: http://localhost:4318/v1/traces)
 *   - OTEL_SERVICE_NAME: Service name in traces (default: crewly-backend)
 *
 * When disabled, all operations return no-op spans with zero overhead.
 *
 * @module services/core/tracing
 */
import { Tracer, Span, SpanOptions } from '@opentelemetry/api';
import { InMemorySpanExporter } from '@opentelemetry/sdk-trace-node';
/**
 * Configuration resolved from environment variables.
 */
export interface TracingConfig {
    /** Whether tracing is enabled */
    enabled: boolean;
    /** OTLP exporter endpoint URL */
    exporterEndpoint: string;
    /** Service name reported in traces */
    serviceName: string;
}
/**
 * Singleton service that manages OpenTelemetry tracing lifecycle.
 *
 * Usage:
 * ```typescript
 * const tracing = TracingService.getInstance();
 * tracing.initialize();
 *
 * // Create a span around an operation
 * const result = await tracing.withSpan('my.operation', { attributes: { key: 'value' } }, async (span) => {
 *   span.setAttribute('custom.attr', 42);
 *   return doWork();
 * });
 *
 * // Or get a tracer for manual instrumentation
 * const tracer = tracing.getTracer();
 * ```
 */
export declare class TracingService {
    private static instance;
    private provider;
    private tracer;
    private config;
    private initialized;
    private constructor();
    /**
     * Get the singleton instance.
     *
     * @returns TracingService instance
     */
    static getInstance(): TracingService;
    /**
     * Reset the singleton (for testing).
     */
    static resetInstance(): void;
    /**
     * Initialize the tracing provider and register it globally.
     * Safe to call multiple times — subsequent calls are no-ops.
     *
     * When OTEL_ENABLED is not 'true', this registers a no-op provider
     * so all span creation has zero overhead.
     */
    initialize(): void;
    /**
     * Initialize with an in-memory exporter for testing.
     * Returns the exporter so tests can inspect captured spans.
     *
     * @returns InMemorySpanExporter instance
     */
    initializeForTesting(): InMemorySpanExporter;
    /**
     * Shut down the tracing provider, flushing pending spans.
     */
    shutdown(): Promise<void>;
    /**
     * Get the active tracer instance.
     *
     * @returns OpenTelemetry Tracer (no-op if tracing is disabled)
     */
    getTracer(): Tracer;
    /**
     * Execute an async function within a traced span.
     *
     * Automatically sets span status to ERROR on exception and records
     * the error message. The span is ended when the function completes.
     *
     * @param name - Span name (use TRACING_CONSTANTS.SPANS values)
     * @param optionsOrFn - SpanOptions or the function to execute
     * @param maybeFn - The function to execute (if options were provided)
     * @returns The return value of the executed function
     */
    withSpan<T>(name: string, optionsOrFn: SpanOptions | ((span: Span) => Promise<T>), maybeFn?: (span: Span) => Promise<T>): Promise<T>;
    /**
     * Execute a synchronous function within a traced span.
     *
     * @param name - Span name
     * @param optionsOrFn - SpanOptions or the function to execute
     * @param maybeFn - The function to execute (if options were provided)
     * @returns The return value of the executed function
     */
    withSpanSync<T>(name: string, optionsOrFn: SpanOptions | ((span: Span) => T), maybeFn?: (span: Span) => T): T;
    /**
     * Get the current tracing configuration.
     *
     * @returns Resolved tracing config
     */
    getConfig(): TracingConfig;
    /**
     * Check whether tracing is enabled and initialized.
     *
     * @returns True if tracing is active
     */
    isEnabled(): boolean;
    /**
     * Resolve configuration from environment variables.
     *
     * @returns TracingConfig with values from env or defaults
     */
    private resolveConfig;
}
//# sourceMappingURL=tracing.service.d.ts.map