diff --git a/lib/routes/metrics.js b/lib/routes/metrics.js index a38dda8955..d5075fa1fd 100644 --- a/lib/routes/metrics.js +++ b/lib/routes/metrics.js @@ -24,6 +24,17 @@ module.exports = function (app, config) { res.json(metrics.getTogglesMetrics()); }); + app.get('/client/metrics/feature-toggles/:name', (req, res) => { + const name = req.params.name; + const data = metrics.getTogglesMetrics(); + const lastHour = data.lastHour[name] || {}; + const lastMinute = data.lastMinute[name] || {}; + res.json({ + lastHour, + lastMinute, + }); + }); + app.post('/client/metrics', (req, res) => { const data = req.body; const clientIp = req.ip; @@ -62,7 +73,7 @@ module.exports = function (app, config) { instanceId: cleaned.instanceId, clientIp, })) - .then(() => logger.info(`New client registered with + .then(() => logger.info(`New client registered with appName=${cleaned.appName} and instanceId=${cleaned.instanceId}`)) .catch(err => logger.error('failed to register client', err));