UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio

134 lines (133 loc) 3.94 kB
/** * Exporter Registry * Manages multiple observability exporters with circuit breaker protection */ import type { BaseExporter } from "./exporters/baseExporter.js"; import type { ExportResult, ExporterHealthStatus, ObservabilityCircuitBreakerConfig, ObservabilityCircuitBreakerState, Sampler, SpanData } from "../types/index.js"; /** * Registry for managing multiple observability exporters * Includes circuit breaker protection to prevent cascading failures */ export declare class ExporterRegistry { private exporters; private defaultExporter; private sampler; private circuitBreakers; private readonly circuitBreakerConfig; /** * Register an exporter */ register(exporter: BaseExporter): void; /** * Unregister an exporter */ unregister(name: string): boolean; /** * Get an exporter by name */ get(name: string): BaseExporter | undefined; /** * Get all registered exporter names */ getNames(): string[]; /** * Get total exporter count */ getCount(): number; /** * Set the default exporter */ setDefault(name: string): void; /** * Get the default exporter */ getDefault(): BaseExporter | undefined; /** * Set the sampler for the registry */ setSampler(sampler: Sampler): void; /** * Get the current sampler */ getSampler(): Sampler; /** * Configure the circuit breaker settings * @param config - Partial circuit breaker configuration */ configureCircuitBreaker(config: Partial<ObservabilityCircuitBreakerConfig>): void; /** * Check if circuit is open for an exporter * @param exporterName - Name of the exporter * @returns true if circuit is open (exporter should be skipped) */ private isCircuitOpen; /** * Record a failure for an exporter's circuit breaker * @param exporterName - Name of the exporter */ private recordFailure; /** * Record a success for an exporter's circuit breaker * Resets the circuit to closed state * @param exporterName - Name of the exporter */ private recordSuccess; /** * Get circuit breaker status for an exporter * @param exporterName - Name of the exporter * @returns Circuit breaker state or undefined if not tracked */ getCircuitBreakerStatus(exporterName: string): ObservabilityCircuitBreakerState | undefined; /** * Reset circuit breaker for an exporter * @param exporterName - Name of the exporter */ resetCircuitBreaker(exporterName: string): void; /** * Export span to all registered exporters * Applies sampling and circuit breaker protection before export */ exportToAll(span: SpanData): Promise<Map<string, ExportResult>>; /** * Export span to a specific exporter * Applies sampling and circuit breaker protection */ exportTo(name: string, span: SpanData): Promise<ExportResult | null>; /** * Initialize all exporters */ initializeAll(): Promise<void>; /** * Shutdown all exporters */ shutdownAll(): Promise<void>; /** * Flush all exporters */ flushAll(): Promise<void>; /** * Get health status of all exporters */ healthCheckAll(): Promise<Map<string, ExporterHealthStatus>>; /** * Check if all exporters are healthy */ isHealthy(): Promise<boolean>; /** * Get total pending spans across all exporters */ getTotalPendingSpans(): number; /** * Clear all registered exporters and reset state * (For testing and cleanup) */ clear(): void; } /** * Get the global exporter registry instance */ export declare function getExporterRegistry(): ExporterRegistry; /** * Reset the global exporter registry (for testing) */ export declare function resetExporterRegistry(): void;