mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-01 00:08:27 +01:00
24 lines
747 B
JavaScript
24 lines
747 B
JavaScript
|
const events = require('./events');
|
||
|
|
||
|
exports.startMonitoring = (enable, eventBus) => {
|
||
|
if (!enable) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
const client = require('prom-client');
|
||
|
const toggleFetch = new client.Counter('toggles_fetch_counter', 'Number of fetch toggles request');
|
||
|
const clientRegister = new client.Counter('client_register_counter', 'Number client register requests');
|
||
|
const clientMetrics = new client.Counter('client_metrics_counter', 'Number client metrics requests');
|
||
|
|
||
|
eventBus.on(events.TOGGLES_FETCH, () => {
|
||
|
toggleFetch.inc();
|
||
|
});
|
||
|
|
||
|
eventBus.on(events.CLIENT_REGISTER, () => {
|
||
|
clientRegister.inc();
|
||
|
});
|
||
|
|
||
|
eventBus.on(events.CLIENT_METRICS, () => {
|
||
|
clientMetrics.inc();
|
||
|
});
|
||
|
};
|