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:
parent
de567735ad
commit
150e484eda
@ -44,7 +44,7 @@ exports.startMonitoring = (
|
|||||||
const featureToggleUsageTotal = new client.Counter({
|
const featureToggleUsageTotal = new client.Counter({
|
||||||
name: 'feature_toggle_usage_total',
|
name: 'feature_toggle_usage_total',
|
||||||
help: 'Number of times a feature toggle has been used',
|
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 }) => {
|
eventBus.on(events.REQUEST_TIME, ({ path, method, time, statusCode }) => {
|
||||||
@ -70,8 +70,8 @@ exports.startMonitoring = (
|
|||||||
|
|
||||||
clientMetricsStore.on('metrics', m => {
|
clientMetricsStore.on('metrics', m => {
|
||||||
for (const [feature, { yes, no }] of Object.entries(m.bucket.toggles)) {
|
for (const [feature, { yes, no }] of Object.entries(m.bucket.toggles)) {
|
||||||
featureToggleUsageTotal.labels(feature, true).inc(yes);
|
featureToggleUsageTotal.labels(feature, true, m.appName).inc(yes);
|
||||||
featureToggleUsageTotal.labels(feature, false).inc(no);
|
featureToggleUsageTotal.labels(feature, false, m.appName).inc(no);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user