/** * Zero-dependency metrics primitives that render to the Prometheus text * exposition format. Counters, gauges and histograms with labels — enough to * drive a `/metrics` endpoint or push to any Prometheus-compatible scraper, * without pulling a client library. */ export type Labels = Record; export declare abstract class Metric { readonly name: string; readonly help: string; readonly labelNames: string[]; abstract readonly type: 'counter' | 'gauge' | 'histogram'; constructor(name: string, help: string, labelNames?: string[]); abstract render(): string; protected header(): string; } export declare class Counter extends Metric { readonly type: 'counter'; private readonly series; inc(labels?: Labels, value?: number): void; render(): string; } export declare class Gauge extends Metric { readonly type: 'gauge'; private readonly series; private mutate; set(value: number, labels?: Labels): void; inc(labels?: Labels, value?: number): void; dec(labels?: Labels, value?: number): void; render(): string; } export declare const DEFAULT_BUCKETS: number[]; export declare class Histogram extends Metric { readonly type: 'histogram'; private readonly series; readonly buckets: number[]; constructor(name: string, help: string, labelNames?: string[], buckets?: number[]); observe(value: number, labels?: Labels): void; render(): string; } export interface MetricOptions { help?: string; labelNames?: string[]; } /** A collection of metrics that renders them all in Prometheus text format. */ export declare class MetricsRegistry { private readonly metrics; private getOrCreate; counter(name: string, options?: MetricOptions): Counter; gauge(name: string, options?: MetricOptions): Gauge; histogram(name: string, options?: MetricOptions & { buckets?: number[]; }): Histogram; /** Prometheus text exposition (content-type text/plain; version=0.0.4). */ render(): string; }