Skip to content

Commit 02a4e1d

Browse files
authored
feat(profiler): configurable profile window length
1 parent fc78970 commit 02a4e1d

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

lib/agent/profiler/cpu/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function CpuProfiler (options) {
1010
var self = this
1111
this.collectorApi = options.collectorApi
1212
this.controlBus = options.controlBus
13-
this.profileWindow = 10000
13+
this.profileWindow = options.config.profilerWindowLength
1414

1515
this.controlBus.on('cpu-profile', function (command) {
1616
self.sendProfile(command)

lib/agent/profiler/cpu/index.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ describe('The Cpu Profiler module', function () {
3434

3535
var profiler = CpuProfiler.create({
3636
collectorApi: collectorApi,
37-
controlBus: msgBus
37+
controlBus: msgBus,
38+
config: {}
3839
})
3940

4041
profiler.profileWindow = 0

lib/utils/configReader.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ ConfigReader.prototype._getEnvVarConfig = function () {
6464
: undefined,
6565
proxy: process.env.TRACE_PROXY || process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY,
6666
keepQueryParams: process.env.TRACE_KEEP_QUERY_PARAMS,
67-
collectSeverity: process.env.TRACE_COLLECT_SEVERITY
67+
collectSeverity: process.env.TRACE_COLLECT_SEVERITY,
68+
profilerWindowLength: process.env.TRACE_PROFILER_WINDOW_LENGTH
69+
? parseInt(process.env.TRACE_PROFILER_WINDOW_LENGTH)
70+
: 10000
6871
}
6972

7073
if (process.env.TRACE_SAMPLER_LIMIT) {

0 commit comments

Comments
 (0)