1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00

add getAppsFromToggleName

This commit is contained in:
sveisvei 2016-12-05 13:27:08 +01:00
parent 94ee490e0d
commit e9938d9a5b
2 changed files with 18 additions and 0 deletions

View File

@ -47,6 +47,19 @@ module.exports = class UnleashClientMetrics {
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 () {
return {
lastHour: this.lastHourProjection.getProjection(),

View File

@ -20,6 +20,11 @@ module.exports = function (app, config) {
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) => {
res.json(metrics.getTogglesMetrics());
});