fix(metrics): convert PostgreSQL COUNT bigint to number
PostgreSQL COUNT() returns bigint type which Drizzle returns as a string. This caused prom-client Gauge.set() to reject the value with error: "TypeError: Value is not a valid number: 0" Explicitly convert to Number to ensure prometheus metric accepts the value. Related: BARAAA-64 - DB migrations and connection fixes Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
cb374c0630
commit
3f3d6203b1
1 changed files with 1 additions and 1 deletions
|
|
@ -17,7 +17,7 @@ async function collectRoomsActiveMetric(pool: Pool): Promise<void> {
|
||||||
.select({ count: sql<number>`count(distinct ${roomMembers.roomId})` })
|
.select({ count: sql<number>`count(distinct ${roomMembers.roomId})` })
|
||||||
.from(roomMembers);
|
.from(roomMembers);
|
||||||
|
|
||||||
const count = result[0]?.count || 0;
|
const count = Number(result[0]?.count) || 0;
|
||||||
roomsActiveGauge.set(count);
|
roomsActiveGauge.set(count);
|
||||||
|
|
||||||
const duration = (performance.now() - startTime) / 1000;
|
const duration = (performance.now() - startTime) / 1000;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue