diff --git a/plugins/catalog-backend/src/next/database/metrics.ts b/plugins/catalog-backend/src/next/database/metrics.ts index f3e08287d8..a41ad512f0 100644 --- a/plugins/catalog-backend/src/next/database/metrics.ts +++ b/plugins/catalog-backend/src/next/database/metrics.ts @@ -52,16 +52,20 @@ export function initDatabaseMetrics(knex: Knex) { name: 'catalog_registered_locations_count', help: 'Total amount of registered locations in the catalog', async collect() { - const total = await knex('locations').count(); - this.set(total[0]['count(*)'] as number); + const total = await knex('locations').count({ + count: '*', + }); + this.set(Number(total[0].count)); }, }), relations: createGaugeMetric({ name: 'catalog_relations_count', help: 'Total amount of relations between entities', async collect() { - const total = await knex('relations').count(); - this.set(total[0]['count(*)'] as number); + const total = await knex('relations').count({ + count: '*', + }); + this.set(Number(total[0].count)); }, }), };