UNPKG

@hemantwasthere/monitoring-sdk

Version:

Centralized monitoring SDK for Node.js applications with Prometheus, Loki, and Grafana integration

50 lines (49 loc) 1.65 kB
import { LoggingService } from "./logging"; import { MetricsService } from "./metrics"; import { GlobalMonitoringConfig, MonitoringConfig } from "./types"; export declare class MonitoringSDK { private static instance; private static globalConfig; private metricsService; private loggingService; private config; private constructor(); /** * Set the global settings for all monitoring * Call this once when your app starts up */ static setGlobalConfig(config: GlobalMonitoringConfig): void; static getGlobalConfig(): GlobalMonitoringConfig | null; /** * Easy setup - just give it your app details and it works! * No need to worry about URLs or configuration */ static initializeWithDefaults(config: { projectName: string; serviceName: string; technology: string; customLabels?: Record<string, string>; prefixCustomMetrics?: boolean; prefixAllMetrics?: boolean; enableDefaultMetrics?: boolean; environment?: string; lokiHost?: string; metricsPath?: string; }): MonitoringSDK; static reset(): void; static initialize(config: MonitoringConfig): MonitoringSDK; static getInstance(): MonitoringSDK; getMetrics(): MetricsService; getLogger(): LoggingService; getConfig(): MonitoringConfig; /** * Dynamically get the appropriate middleware based on technology */ getMiddleware(): any; } export * from "./constants"; export * from "./controller"; export * from "./cron-monitor"; export * from "./logging"; export * from "./metrics"; export * from "./types";