Skip to content

Commit d32a3f5

Browse files
committed
fix(samplerate): initial sample rate can be overwritten from env
1 parent c95097e commit d32a3f5

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

lib/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var config = {};
22

33
config.collectInterval = process.env.TRACE_COLLECT_INTERVAL || 2 * 60 * 1000;
44
config.sampleSize = 60;
5+
config.initialSampleRate = process.env.TRACE_INITIAL_SAMPLE_RATE || 50;
56

67
config.collectorApi = process.env.TRACE_COLLECTOR_API_URL ||
78
'https://trace-collector-api.risingstack.com';

lib/providers/httpTransaction/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var microtime = require('microtime');
77

88
var getNamespace = require('continuation-local-storage').getNamespace;
99
var wraps = require('./wraps');
10+
var config = require('../../config');
1011

1112
/*
1213
* @class HttpTransaction
@@ -21,7 +22,7 @@ function HttpTransaction(eventBus, options) {
2122

2223
this.apiKey = options.apiKey;
2324
this.collectInterval = options.collectInterval;
24-
this.sampleRate = 50;
25+
this.sampleRate = config.initialSampleRate;
2526
this.sampleSize = options.sampleSize;
2627
this.partials = {};
2728
this.traces = [];

0 commit comments

Comments
 (0)