/** * Metrics Collection * * Counters and histograms for observability. */ import type { MetricStats } from './types.js'; export declare class Metrics { private counters; private histograms; private gauges; /** * Increment a counter. */ increment(name: string, value?: number): void; /** * Decrement a counter. */ decrement(name: string, value?: number): void; /** * Record a value in a histogram. */ histogram(name: string, value: number): void; /** * Set a gauge value. */ gauge(name: string, value: number): void; /** * Get a counter value. */ getCounter(name: string): number; /** * Get a gauge value. */ getGauge(name: string): number; /** * Get histogram statistics. */ getHistogramStats(name: string): MetricStats | null; /** * Get all metrics. */ getAll(): { counters: Record; gauges: Record; histograms: Record; }; /** * Reset all metrics. */ reset(): void; /** * Reset a specific metric. */ resetMetric(name: string): void; /** * Export metrics as Prometheus-style text. */ toPrometheus(): string; /** * Calculate percentile from sorted array. */ private percentile; } /** * Get or create global metrics instance. */ export declare function getMetrics(): Metrics; /** * Create a new metrics instance. */ export declare function createMetrics(): Metrics; export declare const METRIC_NAMES: { readonly REQUESTS_STARTED: "requests.started"; readonly REQUESTS_SUCCESS: "requests.success"; readonly REQUESTS_FAILURE: "requests.failure"; readonly REQUESTS_TIMEOUT: "requests.timeout"; readonly REQUESTS_CIRCUIT_BLOCKED: "requests.circuit_breaker_blocked"; readonly REQUEST_DURATION_MS: "requests.duration_ms"; readonly SPAWN_DURATION_MS: "spawn.duration_ms"; readonly PROCESSES_ACTIVE: "processes.active"; readonly PROCESSES_SPAWNED: "processes.spawned"; readonly PROCESSES_KILLED: "processes.killed"; readonly ERRORS_AUTH: "errors.auth"; readonly ERRORS_RATE_LIMIT: "errors.rate_limit"; readonly ERRORS_TIMEOUT: "errors.timeout"; readonly ERRORS_NETWORK: "errors.network"; readonly ERRORS_UNKNOWN: "errors.unknown"; readonly RETRIES_ATTEMPTED: "retries.attempted"; readonly RETRIES_SUCCESS: "retries.success"; }; //# sourceMappingURL=metrics.d.ts.map