Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Summary#observe does not throw when adding additional labels to labelset #262

Closed
samt opened this issue May 20, 2019 · 0 comments · Fixed by #423
Closed

Summary#observe does not throw when adding additional labels to labelset #262

samt opened this issue May 20, 2019 · 0 comments · Fixed by #423

Comments

@samt
Copy link

samt commented May 20, 2019

Reproduction:

const { Summary } = require('prom-client');

const summary = new Summary({
    name: 'foobar',
    help: 'Foo Bar',
    labelNames: ['foo']
});

summary.observe({ foo: 'bar', baz: 'qaz' }, 10);
console.log('did NOT throw');

Expected

Error: Added label "baz" is not included in initial labelset: [ 'foo' ]
    at Object.keys.forEach.label (/Users/samt/Repos/prom-client/lib/validation.js:26:10)
    at Array.forEach (native)
    at validateLabel (/Users/samt/Repos/prom-client/lib/validation.js:24:22)
    at /Users/samt/Repos/prom-client/lib/gauge.js:238:3
    at Gauge.set (/Users/samt/Repos/prom-client/lib/gauge.js:91:32)
    at Object.<anonymous> (/Users/samt/Repos/reprod-prom/index.js:19:7)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)

Actual

did NOT throw

Issue is caused by lib/summary.js#L245

validateLabel(this.labelNames, this.labels);

Should be:

validateLabel(this.labelNames, labels);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant