@gati-framework/observability
Version:
Observability stack for Gati framework - Prometheus, Grafana, Loki, and Tracing
20 lines (19 loc) • 949 B
TypeScript
import { Registry, Counter, Histogram, Gauge } from 'prom-client';
export declare class PrometheusMetrics {
private registry;
private httpRequestDuration;
private httpRequestTotal;
private activeConnections;
private errorTotal;
constructor();
recordRequest(method: string, route: string, statusCode: number, duration: number): void;
incrementConnections(): void;
decrementConnections(): void;
recordError(type: string, route: string): void;
createCounter(name: string, help: string, labelNames?: string[]): Counter<string>;
createGauge(name: string, help: string, labelNames?: string[]): Gauge<string>;
createHistogram(name: string, help: string, labelNames?: string[], buckets?: number[]): Histogram<string>;
getMetrics(): Promise<string>;
getRegistry(): Registry;
}
export declare function createPrometheusMiddleware(metrics: PrometheusMetrics): (req: any, res: any, next: any) => void;