From 7460326c5d429332584e3ab27e676c1279351d85 Mon Sep 17 00:00:00 2001 From: sveisvei Date: Sun, 13 Nov 2016 21:25:37 +0100 Subject: [PATCH] add count to app state --- lib/client-metrics/client-metrics.test.js | 1 + lib/client-metrics/index.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lib/client-metrics/client-metrics.test.js b/lib/client-metrics/client-metrics.test.js index b8d738a7b0..7beef4c9e4 100644 --- a/lib/client-metrics/client-metrics.test.js +++ b/lib/client-metrics/client-metrics.test.js @@ -78,6 +78,7 @@ test('addPayload', t => { t.truthy(metrics.clients[instanceId].appName === appName); t.truthy(metrics.clients[instanceId].count === 123); + t.truthy(metrics.apps[appName].count === 123); t.truthy(metrics.globalCount === 123); t.deepEqual(metrics.getTogglesMetrics().lastHour.toggleX, { yes: 123, no: 0 }); diff --git a/lib/client-metrics/index.js b/lib/client-metrics/index.js index 2facdf45df..13a15ea50c 100644 --- a/lib/client-metrics/index.js +++ b/lib/client-metrics/index.js @@ -81,6 +81,9 @@ module.exports = class UnleashClientMetrics { if (this.clients[instanceId]) { this.clients[instanceId].count += count; } + if (this.apps[appName]) { + this.apps[appName].count += count; + } } }