diff --git a/package.json b/package.json index 451639c..e651050 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nflx-spectator", - "version": "2.0.0", + "version": "2.0.1", "author": "Matthew Johnson ", "main": "src/index.js", "types": "src/index.d.ts", diff --git a/src/registry.js b/src/registry.js index 09fae03..9aa182b 100644 --- a/src/registry.js +++ b/src/registry.js @@ -174,7 +174,7 @@ class AtlasRegistry { return; } - this.logger.info(`Starting spectator registry with config: ${c}`); + this.logger.info(`Starting spectator registry with config: ${JSON.stringify(c)}`); this.started = true; this.startId = setInterval(AtlasRegistry._publish, c.frequency || 5000, this); this.startId.unref(); diff --git a/test/registry.test.js b/test/registry.test.js index 3bb8ed9..5831774 100644 --- a/test/registry.test.js +++ b/test/registry.test.js @@ -6,8 +6,8 @@ const assert = chai.assert; const AtlasRegistry = require('../src/registry'); const MeterId = require('../src/meter_id'); -function newRegistry() { - const c = { +function newConfig() { + return { strictMode: true, commonTags: { 'nf.node': 'i-12345', @@ -15,10 +15,21 @@ function newRegistry() { 'nf.app': 'app' } }; +} + +function newRegistry() { + const c = newConfig(); return new AtlasRegistry(c); } describe('AtlasRegistry', () => { + it('should log config correctly', () => { + const c = newConfig(); + const log = `${JSON.stringify(c)}`; + const expected = '{"strictMode":true,"commonTags":{"nf.node":"i-12345","nf.cluster":"app-main","nf.app":"app"}}'; + assert.deepEqual(log, expected); + }); + it('measurements', () => { const r = newRegistry(); r.counter('c').increment();