import { MetricMap, Gauge, Histogram } from '@spinajs/telemetry-common'; /** * Point-in-time view of a driver's connection pool. */ export interface IPoolMetrics { /** Connections currently open ( idle + in use ). */ Size: number; /** Connections currently checked out by a query. */ InUse: number; /** Callers waiting for a free connection. */ Waiting: number; } /** * Prefix `Metrics.defineMetrics` puts in front of every name below. */ export declare const ORM_METRIC_PREFIX = "orm"; /** Key of a metric inside the {@link MetricMap} — the name WITHOUT the `orm_` prefix. */ export declare const ORM_METRIC_KEY_POOL_SIZE = "pool_size"; export declare const ORM_METRIC_KEY_POOL_IN_USE = "pool_in_use"; export declare const ORM_METRIC_KEY_POOL_WAITING = "pool_waiting"; export declare const ORM_METRIC_KEY_ACQUIRE_SECONDS = "pool_acquire_seconds"; export declare const ORM_METRIC_KEY_CONNECTION_STATE = "connection_state"; /** Fully qualified metric names, as they appear in the Prometheus exposition text. */ export declare const ORM_METRIC_POOL_SIZE = "orm_pool_size"; export declare const ORM_METRIC_POOL_IN_USE = "orm_pool_in_use"; export declare const ORM_METRIC_POOL_WAITING = "orm_pool_waiting"; export declare const ORM_METRIC_ACQUIRE_SECONDS = "orm_pool_acquire_seconds"; export declare const ORM_METRIC_CONNECTION_STATE = "orm_connection_state"; /** * Acquiring a pooled connection is normally sub-millisecond and only becomes interesting once the * pool saturates, so the buckets are dense at the bottom and reach far enough to show a caller * that queued for seconds. prom-client's linear default ( 1..10 SECONDS ) would put every healthy * acquire in the first bucket and tell us nothing. */ export declare const ORM_ACQUIRE_BUCKETS_SECONDS: number[]; /** * The ORM's metric set, built against the shared `Metrics` service from * `@spinajs/telemetry-common`. * * The ORM deliberately depends on `-common` and NOT on `@spinajs/telemetry`: that package pulls in * `@spinajs/http`, `@spinajs/log`, `@spinajs/validation` and `@spinajs/configuration`, and putting * the HTTP stack underneath every database connection inverts the dependency graph. `-common` * needs nothing but `@spinajs/di` and prom-client. `@spinajs/telemetry` re-exports it, so the * `/metrics` endpoint renders the very registry these metrics land in — no wiring needed. * * Returns null rather than throwing when the service cannot be resolved: publishing a metric must * never be able to fail a query or a health probe. */ export declare function ormMetrics(): MetricMap | null; /** Narrowing helpers: `defineMetrics` is typed by its declarations, not by the values it returns. */ export declare function ormGauge(map: MetricMap, key: string): Gauge; export declare function ormHistogram(map: MetricMap, key: string): Histogram; //# sourceMappingURL=metrics.d.ts.map