prom-client: add category for connection handler

This commit is contained in:
undefined committed 2022-11-06 07:17:11 +08:00
1 parent 1e62a9b027
commit 3c97ff74a9
3 files changed
+5 -2

No files matched your search

+2 -2
View File
@@ -40,10 +40,10 @@ export function createRegistry(ctx: Context) {
labelNames: ['domainId'],
});
ctx.on('connection/active', (h) => {
connectionGauge.inc({ domainId: h.args.domainId });
connectionGauge.inc({ domainId: (h as any).category || h.args.domainId });
});
ctx.on('connection/close', (h) => {
connectionGauge.dec({ domainId: h.args.domainId });
connectionGauge.dec({ domainId: (h as any).category || h.args.domainId });
});
const taskColl = db.collection('task');