mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-28 00:06:53 +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) : [];
|
||||
}
|
||||
|
||||
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(),
|
||||
|
@ -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());
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user