-
Notifications
You must be signed in to change notification settings - Fork 805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(sdk-node): Allow Defining Sampler with Exporter in Env #4394
fix(sdk-node): Allow Defining Sampler with Exporter in Env #4394
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #4394 +/- ##
==========================================
- Coverage 92.39% 92.23% -0.16%
==========================================
Files 331 336 +5
Lines 9518 9533 +15
Branches 2022 2021 -1
==========================================
- Hits 8794 8793 -1
- Misses 724 740 +16
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good % changelog nit
Thanks for taking care of this 🙂
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had another look, as I was wondering how this affects the setup when
- a sampler is configured manually
- an exporter is configured via the environment
and now it looks like the sampler is configured, but the exporter is not. @JacksonWeber would you mind having another look to verify? I think we'd want the config to merge so that the exporter is configured via the environment, but the sampler is set to what's passed to NodeSDK.
Took a look into this. You were correct that it would ignore the configured exporter. I've updated the logic to use a |
…e using the NodeTracerProvider.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, now it seems like two span processors are registered, one with the correct exporter (if set via an env var) and the other without an exporter.
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
…b.com/JacksonWeber/opentelemetry-js into jacksonweber/sampler-without-exporter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for working on this and thanks for taking the time to address the comment 🙂
Just a few test nits then this PR should be ready to merge. 🙂
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
…metry#4394) * fix(sdk-node): Allow tracerProvider to be created when exporter is defined in the env. * fix(node-sdk): Update to not accept when exporter is set to none. * fix(sdk-node): Update Changelog. * fix(sdk-node): Fix Changelog. * fix(sdk-node): cleanup changelog. * fix(sdk-node): lint fix * fix(sdk-node): Fix logic for creating tracerProviders. * Fix lint. * Update experimental/CHANGELOG.md Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com> * Fix manual sampler and environment exporter case. * Update logic to check for a defined traceExporter on the config before using the NodeTracerProvider. * Fix equality check. * Update env exporter configuration logic and add tests. * Update experimental/CHANGELOG.md Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com> * Fix changelog issues. * Clean up tracerProvider logic. * Update sdk.ts * Update sdk.ts * Update experimental/packages/opentelemetry-sdk-node/test/sdk.test.ts Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com> * Update experimental/packages/opentelemetry-sdk-node/test/sdk.test.ts Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com> * Update experimental/packages/opentelemetry-sdk-node/test/sdk.test.ts Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com> --------- Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
Which problem is this PR solving?
Previously if the exporter was defined via the environment, any configured values like samplers would not be read from the NodeSDK configuration. By updating the check we allow for those configurations to be read even if the traceExporter/spanProcessor is not defined directly in the NodeSDK configuration.
Fixes #4212
Fixes #4004
Short description of the changes
Modies the SDK such that if the trace exporter is configured via the environment we still create/configure the tracerProvider.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Tested locally using a sample application to confirm that the changes allow the sampler to be read from the NodeSDK configuration even when the exporter is not defined outside of the environment.
Also added a test to ensure that when the exporter is defined in the environment that the appropriate tracerProvider is created.
Checklist: