import type { IncomingMessage, ServerResponse } from "http"; /** * Stable string label per `MessageType` numeric enum value. Used so that * Prometheus labels stay human-readable across socket.io-adapter versions. */ export declare const MESSAGE_TYPE_NAMES: Readonly>; export declare function messageTypeName(type: number | undefined): string; export type RequestKind = "fetchSockets" | "broadcastWithAck" | "serverSideEmit"; /** * Thin abstraction over the metrics backend so the hot paths never directly * import `prom-client`. Implementations must be no-throw and ideally * zero-allocation on the no-op path. */ export interface MetricsRegistry { peerUp(uid: string): void; peerDown(uid: string, reason: string): void; expectedPeersChanged(n: number): void; messageSent(type: number, bytes: number): void; messageReceived(type: number, bytes: number): void; /** Start a request timer; returns a stop function (must be called exactly once). */ requestStarted(kind: RequestKind): () => void; localClientsChanged(n: number): void; namespacesChanged(n: number): void; /** Build a Node http.RequestListener that serves Prometheus text format. */ handler(): (req: IncomingMessage, res: ServerResponse) => void; } /** * Zero-cost registry used when the user does not opt into Prometheus. Methods * are bound to the singleton so closures and hot paths can use them safely. */ export declare const NoopMetricsRegistry: MetricsRegistry; /** * Prometheus-backed registry. Constructing this class lazily imports * `prom-client`, so users who omit the `metrics` option never load it. */ export declare class PromMetricsRegistry implements MetricsRegistry { private readonly registry; private readonly client; private readonly gPeersConnected; private readonly gPeersExpected; private readonly cMessagesSent; private readonly cMessagesReceived; private readonly hMessageBytes; private readonly hRequestDuration; private readonly cPeerDrops; private readonly gNamespaces; private readonly gIoClients; constructor(opts?: { defaultLabels?: Record; }); peerUp(_uid: string): void; peerDown(_uid: string, reason: string): void; expectedPeersChanged(n: number): void; messageSent(type: number, bytes: number): void; messageReceived(type: number, bytes: number): void; requestStarted(kind: RequestKind): () => void; localClientsChanged(n: number): void; namespacesChanged(n: number): void; handler(): (req: IncomingMessage, res: ServerResponse) => void; } //# sourceMappingURL=metrics.d.ts.map