@christiangalsterer/node-postgres-prometheus-exporter
Version:
A prometheus exporter for node-postgres
40 lines (39 loc) • 1.59 kB
TypeScript
import type { Pool, PoolClient } from 'pg';
import { type Registry } from 'prom-client';
import type { PgPoolExporterOptions } from './pgPoolExporterOptions';
/**
* Exports metrics for the pg.Pool module
*/
export declare class PgPoolPrometheusExporter {
private readonly pool;
private readonly register;
private readonly options;
private readonly defaultOptions;
private readonly poolMaxSize;
private readonly poolHost;
private readonly poolPort;
private readonly poolDatabase;
private readonly PG_POOL_CONNECTIONS_CREATED_TOTAL;
private readonly PG_POOL_SIZE;
private readonly PG_POOL_MAX;
private readonly PG_POOL_ACTIVE_CONNECTIONS;
private readonly PG_POOL_WAITING_CONNECTIONS;
private readonly PG_POOL_IDLE_CONNECTIONS;
private readonly PG_POOL_ERRORS_TOTAL;
private readonly PG_POOL_CONNECTIONS_REMOVED_TOTAL;
private readonly poolConnectionsCreatedTotal;
private readonly poolSize;
private readonly poolSizeMax;
private readonly poolErrors;
private readonly poolConnectionsRemovedTotal;
private readonly poolActiveConnections;
private readonly poolWaitingConnections;
private readonly poolIdleConnections;
constructor(pool: Pool, register: Registry, options?: PgPoolExporterOptions);
enableMetrics(): void;
onPoolConnect(client: PoolClient): void;
onPoolConnectionAcquired(client: PoolClient): void;
onPoolError(error: Error): void;
onPoolConnectionReleased(_error: Error, client: PoolClient): void;
onPoolConnectionRemoved(client: PoolClient): void;
}