NodeSDK configuration with sampler and other settings not applied when using exporter from env #4004
Labels
bug
Something isn't working
priority:p2
Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect
up-for-grabs
Good for taking. Extra help will be provided by maintainers
What happened?
Steps to Reproduce
Configure
NodeSDK
withsampler: new AlwaysOffSampler()
but notraceExporter
and run withOTEL_TRACES_EXPORTER=console
.Expected Result
No spans are logged
Actual Result
All spans are logged because the sampler setting is ignored
Additional Details
It seems to be related to only reading the configuration when exporter is defined
https://github.com/open-telemetry/opentelemetry-js/blob/main/experimental/packages/opentelemetry-sdk-node/src/sdk.ts#L132
But I guess intuitively, the configuration is supposed to work even when using environment variable selection for exporter.
Note, while the example above for simplicitly is using alwaysoffsampler, and thus could have been configured with env var, actually I want to use a custom sampler so need to set it programatically.
OpenTelemetry Setup Code
package.json
Leaving this out since the code in `main` seems obvious enough
Relevant log output
No response
The text was updated successfully, but these errors were encountered: