@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
59 lines (58 loc) • 2.41 kB
TypeScript
import type { HealthMetrics } from "../types/index.js";
export declare class TelemetryService {
private static instance;
private tracerProvider?;
private enabled;
private initialized;
private usingExternalTracerProvider;
private meter?;
private tracer?;
private aiRequestCounter?;
private aiRequestDuration?;
private aiTokensUsed?;
private aiProviderErrors?;
private aiCostUsd?;
private mcpToolCalls?;
private connectionCounter?;
private responseTimeHistogram?;
private activeConnectionCount;
private errorCount;
private requestCount;
private totalResponseTime;
private responseTimeCount;
private constructor();
static getInstance(): TelemetryService;
private isTelemetryEnabled;
private hasExternalTracerProvider;
private adoptExternalTracerProvider;
private initializeTelemetry;
private initializeMetrics;
initialize(): Promise<void>;
/**
* @deprecated Vercel AI SDK's experimental_telemetry creates ai.generateText/ai.streamText
* spans automatically via OpenTelemetry. Using this method would create duplicate spans.
* Kept for potential future use with non-Vercel providers (e.g., Amazon Bedrock).
* See: TelemetryHandler.getTelemetryConfig() for the active telemetry path.
*/
traceAIRequest<T>(provider: string, operation: () => Promise<T>, operationType?: string): Promise<T>;
recordAIRequest(provider: string, model: string, tokens: number, duration: number, cost?: number): void;
recordAIError(provider: string, error: Error): void;
recordMCPToolCall(toolName: string, duration: number, success: boolean): void;
recordConnection(type: "websocket" | "sse" | "http"): void;
recordConnectionClosed(type: "websocket" | "sse" | "http"): void;
recordResponseTime(endpoint: string, method: string, duration: number): void;
recordCustomMetric(name: string, value: number, labels?: Record<string, string>): void;
recordCustomHistogram(name: string, value: number, labels?: Record<string, string>): void;
getHealthMetrics(): Promise<HealthMetrics>;
isEnabled(): boolean;
getStatus(): {
enabled: boolean;
initialized: boolean;
endpoint?: string;
service?: string;
version?: string;
};
private getDurationBucket;
private getStatusBucket;
shutdown(): Promise<void>;
}