mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-18 04:44:24 +01:00
Add back pool size gauge
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user