Add back pool size gauge

This commit is contained in:
Alex Gleason 2024-09-07 09:00:18 -05:00
parent 5454942a2c
commit 4a578528f5
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 7 additions and 1 deletions

View file

@ -2,11 +2,12 @@ import { register } from 'prom-client';
import { AppController } from '@/app.ts';
import { DittoDB } from '@/db/DittoDB.ts';
import { dbAvailableConnectionsGauge } from '@/metrics.ts';
import { dbAvailableConnectionsGauge, dbPoolSizeGauge } from '@/metrics.ts';
/** Prometheus/OpenMetrics controller. */
export const metricsController: AppController = async (c) => {
// Update some metrics at request time.
dbPoolSizeGauge.set(DittoDB.poolSize);
dbAvailableConnectionsGauge.set(DittoDB.availableConnections);
const metrics = await register.metrics();

View file

@ -70,6 +70,11 @@ export const dbEventsCounter = new Counter({
labelNames: ['kind'],
});
export const dbPoolSizeGauge = new Gauge({
name: 'ditto_db_pool_size',
help: 'Number of connections in the database pool',
});
export const dbAvailableConnectionsGauge = new Gauge({
name: 'ditto_db_available_connections',
help: 'Number of available connections in the database pool',