Skip to content

Commit

Permalink
fix config logging at startup (#78)
Browse files Browse the repository at this point in the history
Fixes #77.
  • Loading branch information
copperlight authored Nov 28, 2023
1 parent be34df8 commit 68f2393
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nflx-spectator",
"version": "2.0.0",
"version": "2.0.1",
"author": "Matthew Johnson <[email protected]>",
"main": "src/index.js",
"types": "src/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
15 changes: 13 additions & 2 deletions test/registry.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,30 @@ 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',
'nf.cluster': 'app-main',
'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();
Expand Down

0 comments on commit 68f2393

Please sign in to comment.