Closed eh-am closed 1 year ago
The env var is assigned here https://github.com/pyroscope-io/pyroscope-nodejs/blob/09d3f4d1b77d8640181e871db0fa3d60919e4a7d/src/index.ts#L30
And then it's used here https://github.com/pyroscope-io/pyroscope-nodejs/blob/09d3f4d1b77d8640181e871db0fa3d60919e4a7d/src/index.ts#L204
But the expression seems wrong
(seconds || 10) * 1000 || Number(SAMPLING_DURATION_MS)
Since (seconds || 10) will default to 10, which is then multiplied by 1000, which is truthy. Therefore it never defaults to whatever SAMPLING_DURATION_MS is.
(seconds || 10)
10
1000
SAMPLING_DURATION_MS
NVM there are 2 different code paths: https://github.com/pyroscope-io/pyroscope-nodejs/blob/09d3f4d1b77d8640181e871db0fa3d60919e4a7d/src/index.ts#L195 https://github.com/pyroscope-io/pyroscope-nodejs/blob/09d3f4d1b77d8640181e871db0fa3d60919e4a7d/src/index.ts#L249
The env var is assigned here https://github.com/pyroscope-io/pyroscope-nodejs/blob/09d3f4d1b77d8640181e871db0fa3d60919e4a7d/src/index.ts#L30
And then it's used here https://github.com/pyroscope-io/pyroscope-nodejs/blob/09d3f4d1b77d8640181e871db0fa3d60919e4a7d/src/index.ts#L204
But the expression seems wrong
Since
(seconds || 10)
will default to10
, which is then multiplied by1000
, which is truthy. Therefore it never defaults to whateverSAMPLING_DURATION_MS
is.