Skip to content

Commit 6553310

Browse files
authored
feat(config): make the collect-severity configurable
1 parent fd3a8b7 commit 6553310

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

lib/agent/tracer/collector.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ function Collector (options) {
4747
this._lockExpriryMs = 240000
4848
this._eventBuffers = { }
4949
this._sampler = reservoirSampler.create(this.samplerLimit)
50+
51+
if (!isNaN(levels[options.collectSeverity])) {
52+
this.mustCollectSeverity = levels[options.collectSeverity]
53+
}
5054
}
5155

5256
Collector.prototype.LEVELS = levels

lib/agent/tracer/collector.spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ describe('Collector', function () {
1919
afterEach(function () {
2020
clock.restore()
2121
})
22+
23+
describe('during instantiation', function () {
24+
it('must collect severity can be changed', function () {
25+
var tracer = new Collector({
26+
collectSeverity: 'DEBUG'
27+
})
28+
29+
expect(tracer.mustCollectSeverity).to.eql(7)
30+
})
31+
})
32+
2233
describe('SR', function () {
2334
var payload = {
2435
protocol: 'http',

lib/utils/configReader.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ ConfigReader.prototype._getEnvVarConfig = function () {
6464
? process.env.TRACE_DISABLE_INSTRUMENTATIONS.split(',')
6565
: undefined,
6666
proxy: process.env.TRACE_PROXY || process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY,
67-
keepQueryParams: process.env.TRACE_KEEP_QUERY_PARAMS
67+
keepQueryParams: process.env.TRACE_KEEP_QUERY_PARAMS,
68+
collectSeverity: process.env.TRACE_COLLECT_SEVERITY
6869
}
6970

7071
if (process.env.TRACE_SAMPLER_LIMIT) {

0 commit comments

Comments
 (0)