Skip to content
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

feat(sdk-trace-base)!: drop ability to auto-instantiate propagators beyond defaults #5355

Conversation

pichlermarc
Copy link
Member

Which problem is this PR solving?

It is currently confusing which packages implement auto-configure and to which extent. We currently auto-instantiated propagators based on environment variables in sdk-trace-base.

This PR makes it so that only the default propagators get registered when *TracerProvider#register() is called.
The auto-configuration code moves to @opentelemetry/sdk-node. Dependencies to other propagators are removed from @opentelemetry/sdk-trace-node. #4672

I will follow up later on removing BasicTracerProvider#register() (tracked in #5290)

Fixes #4672
Refs #5290

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

  • Unit tests

Copy link

codecov bot commented Jan 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.64%. Comparing base (3c040c4) to head (c5c5f43).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5355      +/-   ##
==========================================
+ Coverage   94.63%   94.64%   +0.01%     
==========================================
  Files         318      318              
  Lines        8032     8036       +4     
  Branches     1685     1689       +4     
==========================================
+ Hits         7601     7606       +5     
+ Misses        431      430       -1     
Files with missing lines Coverage Δ
...imental/packages/opentelemetry-sdk-node/src/sdk.ts 96.03% <100.00%> (+0.01%) ⬆️
...ental/packages/opentelemetry-sdk-node/src/utils.ts 91.37% <100.00%> (+3.14%) ⬆️
...elemetry-sdk-trace-base/src/BasicTracerProvider.ts 95.58% <100.00%> (+0.03%) ⬆️
...telemetry-sdk-trace-node/src/NodeTracerProvider.ts 100.00% <ø> (ø)

@pichlermarc pichlermarc changed the title feat(sdk-trace-base)!: drop ability to instantiate propagators beyond defaults feat(sdk-trace-base)!: drop ability to auto-instantiate propagators beyond defaults Jan 21, 2025
@pichlermarc pichlermarc marked this pull request as ready for review January 22, 2025 11:46
@pichlermarc pichlermarc requested a review from a team as a code owner January 22, 2025 11:46
@@ -117,16 +111,19 @@ export class BasicTracerProvider implements TracerProvider {
*/
register(config: SDKRegistrationConfig = {}): void {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing/replacing this will likely take 3 more PRs to make the change somewhat reviewable

  • introducing an alternative function called registerTraceSdkGlobals() or similar
  • migrating to that new alternative function
  • dropping register()

But this PR is still an improvement for now as we can shed the imports of non-default propagators/context managers.

Copy link
Contributor

@trentm trentm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just a few nits.

@pichlermarc pichlermarc added this pull request to the merge queue Jan 30, 2025
Merged via the queue into open-telemetry:main with commit e265e47 Jan 30, 2025
15 checks passed
@pichlermarc pichlermarc deleted the feat/drop-propagator-autoconfig branch January 30, 2025 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[sdk-trace-base] [sdk-trace-node] remove propagator auto-configuration from package
3 participants