1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: add appName as label

This commit is contained in:
Ivar Conradi Østhus 2019-12-18 15:13:42 +01:00
parent de567735ad
commit 150e484eda

View File

@ -44,7 +44,7 @@ exports.startMonitoring = (
const featureToggleUsageTotal = new client.Counter({
name: 'feature_toggle_usage_total',
help: 'Number of times a feature toggle has been used',
labelNames: ['toggle', 'active'],
labelNames: ['toggle', 'active', 'appName'],
});
eventBus.on(events.REQUEST_TIME, ({ path, method, time, statusCode }) => {
@ -70,8 +70,8 @@ exports.startMonitoring = (
clientMetricsStore.on('metrics', m => {
for (const [feature, { yes, no }] of Object.entries(m.bucket.toggles)) {
featureToggleUsageTotal.labels(feature, true).inc(yes);
featureToggleUsageTotal.labels(feature, false).inc(no);
featureToggleUsageTotal.labels(feature, true, m.appName).inc(yes);
featureToggleUsageTotal.labels(feature, false, m.appName).inc(no);
}
});
};