mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Add back pool size gauge
This commit is contained in:
parent
5454942a2c
commit
4a578528f5
2 changed files with 7 additions and 1 deletions
|
|
@ -2,11 +2,12 @@ import { register } from 'prom-client';
|
||||||
|
|
||||||
import { AppController } from '@/app.ts';
|
import { AppController } from '@/app.ts';
|
||||||
import { DittoDB } from '@/db/DittoDB.ts';
|
import { DittoDB } from '@/db/DittoDB.ts';
|
||||||
import { dbAvailableConnectionsGauge } from '@/metrics.ts';
|
import { dbAvailableConnectionsGauge, dbPoolSizeGauge } from '@/metrics.ts';
|
||||||
|
|
||||||
/** Prometheus/OpenMetrics controller. */
|
/** Prometheus/OpenMetrics controller. */
|
||||||
export const metricsController: AppController = async (c) => {
|
export const metricsController: AppController = async (c) => {
|
||||||
// Update some metrics at request time.
|
// Update some metrics at request time.
|
||||||
|
dbPoolSizeGauge.set(DittoDB.poolSize);
|
||||||
dbAvailableConnectionsGauge.set(DittoDB.availableConnections);
|
dbAvailableConnectionsGauge.set(DittoDB.availableConnections);
|
||||||
|
|
||||||
const metrics = await register.metrics();
|
const metrics = await register.metrics();
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,11 @@ export const dbEventsCounter = new Counter({
|
||||||
labelNames: ['kind'],
|
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({
|
export const dbAvailableConnectionsGauge = new Gauge({
|
||||||
name: 'ditto_db_available_connections',
|
name: 'ditto_db_available_connections',
|
||||||
help: 'Number of available connections in the database pool',
|
help: 'Number of available connections in the database pool',
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue