mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
prom-client: collect event count
This commit is contained in:
1 parent
105bcbd118
commit
defa848c98
2 files changed
+7
-1
No files matched your search
@@ -18,7 +18,6 @@ import message from '../model/message';
|
||||
import * as oplog from '../model/oplog';
|
||||
import problem from '../model/problem';
|
||||
import record from '../model/record';
|
||||
import RecordModel from '../model/record';
|
||||
import ScheduleModel from '../model/schedule';
|
||||
import storage from '../model/storage';
|
||||
import * as system from '../model/system';
|
||||
|
||||
@@ -68,6 +68,13 @@ export function createRegistry(ctx: Context) {
|
||||
labelNames: ['type'],
|
||||
});
|
||||
|
||||
const eventCounter = createMetric(Counter, 'hydro_eventcount', 'eventcount', {
|
||||
labelNames: ['name'],
|
||||
});
|
||||
ctx.on('bus/broadcast', (name) => {
|
||||
eventCounter.inc({ name });
|
||||
});
|
||||
|
||||
collectDefaultMetrics({ register: registry });
|
||||
|
||||
ctx.metrics = registry;
|
||||
|
||||
Reference in new issue
Block a user