Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit 68b9554

Browse files
author
Max Stoiber
committed
Fix db connection count tracking
The previous version with events literally only fired on startup of instances and then never again, making it not useful for showing neat graphs. This fixes it by sending the current count every 5s, no matter if it changes or not, which is how DataDog expects it to be.
1 parent a8646b5 commit 68b9554

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

shared/db/db.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ poolMaster.on('queueing', size => {
5959
statsd.gauge('db.query_queue.size', size);
6060
});
6161

62-
poolMaster.on('size', size => {
63-
statsd.gauge('db.connections.count', size);
64-
});
62+
setInterval(() => {
63+
statsd.gauge('db.connections.count', poolMaster.getLength());
64+
}, 5000);
6565

6666
// Exit the process on unhealthy db in test env
6767
if (process.env.TEST_DB) {

0 commit comments

Comments
 (0)