/** * OpenTelemetry Observability * * Provides metrics, tracing, and logging for Vaspera operations. * Disabled by default, enabled via VASPERA_OTEL_ENABLED=true. * * @module observability/otel */ /** * Metric types for Vaspera operations */ export interface VasperaMetrics { /** Total findings by severity */ findingsTotal: (severity: string, scanner: string) => void; /** Scan duration in milliseconds */ scanDuration: (scanner: string, durationMs: number) => void; /** Certification duration in milliseconds */ certificationDuration: (durationMs: number) => void; /** Agent run count */ agentRuns: (agentType: string, status: "success" | "failure") => void; /** Circuit breaker state changes */ circuitBreakerState: (name: string, state: string) => void; /** Retry attempts */ retryAttempts: (operation: string, attempt: number) => void; } /** * Span context for tracing */ export interface SpanContext { traceId: string; spanId: string; parentSpanId?: string; } /** * Span interface for tracing operations */ export interface Span { /** Set an attribute on the span */ setAttribute(key: string, value: string | number | boolean): void; /** Record an error */ recordException(error: Error): void; /** End the span */ end(): void; /** Get span context */ getContext(): SpanContext; } /** * Tracer interface for creating spans */ export interface Tracer { /** Start a new span */ startSpan(name: string, attributes?: Record): Span; /** Run a function within a span */ withSpan(name: string, fn: (span: Span) => Promise): Promise; } /** * Check if OpenTelemetry is enabled */ export declare function isOtelEnabled(): boolean; /** * Get the OTLP endpoint */ export declare function getOtlpEndpoint(): string; /** * Initialize OpenTelemetry (lazy initialization) * * When VASPERA_OTEL_ENABLED=true, this will: * 1. Initialize the OTEL SDK * 2. Set up OTLP exporter * 3. Register metrics and tracing providers * * When disabled (default), returns no-op implementations. */ export declare function initializeOtel(): Promise; /** * Get the metrics instance */ export declare function getMetrics(): VasperaMetrics; /** * Get the tracer instance */ export declare function getTracer(): Tracer; /** * Get in-memory metrics stats (when OTEL is disabled) */ export declare function getInMemoryStats(): { findings: Record; recentScans: Array<{ scanner: string; durationMs: number; timestamp: Date; }>; agentRuns: Record; }; /** * Reset in-memory metrics (for testing) */ export declare function resetInMemoryStats(): void; //# sourceMappingURL=otel.d.ts.map