mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-01 00:08:27 +01:00
add getAppsFromToggleName
This commit is contained in:
parent
94ee490e0d
commit
e9938d9a5b
@ -47,6 +47,19 @@ module.exports = class UnleashClientMetrics {
|
|||||||
return this.apps[appName] ? Object.keys(this.apps[appName].seenToggles) : [];
|
return this.apps[appName] ? Object.keys(this.apps[appName].seenToggles) : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getAppsFromToggleName (toggleName) {
|
||||||
|
const apps = [];
|
||||||
|
Object.keys(this.apps).forEach(appName => {
|
||||||
|
const seenToggles = Object.keys(this.apps[appName].seenToggles);
|
||||||
|
if (seenToggles.includes(toggleName)) {
|
||||||
|
apps.push({
|
||||||
|
appName,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return apps;
|
||||||
|
}
|
||||||
|
|
||||||
getTogglesMetrics () {
|
getTogglesMetrics () {
|
||||||
return {
|
return {
|
||||||
lastHour: this.lastHourProjection.getProjection(),
|
lastHour: this.lastHourProjection.getProjection(),
|
||||||
|
@ -20,6 +20,11 @@ module.exports = function (app, config) {
|
|||||||
res.json(seenAppToggles);
|
res.json(seenAppToggles);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.get('/client/seen-apps/:name', (req, res) => {
|
||||||
|
const seenApps = metrics.getAppsFromToggleName(req.params.name);
|
||||||
|
res.json(seenApps);
|
||||||
|
});
|
||||||
|
|
||||||
app.get('/client/metrics/feature-toggles', (req, res) => {
|
app.get('/client/metrics/feature-toggles', (req, res) => {
|
||||||
res.json(metrics.getTogglesMetrics());
|
res.json(metrics.getTogglesMetrics());
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user