Skip to content

Conversation

@andrzejressel
Copy link
Contributor

@andrzejressel andrzejressel commented Jul 19, 2025

Changes

This pull requests align setting global tracer with settings global metrics - mem::replace was replaced with mutable assignment and old tracer is no longer returned.

In addition failure to set global tracer does not crash program anymore - it will return noop and log error - like with global metrics

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

Copilot AI review requested due to automatic review settings July 19, 2025 22:19
@andrzejressel andrzejressel requested a review from a team as a code owner July 19, 2025 22:19
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jul 19, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR aligns the behavior of the global tracer provider with the global metrics provider by modifying the set_tracer_provider function to not return the previous provider and adding error handling that returns noop implementations with logging instead of panicking.

  • Changed set_tracer_provider return type from GlobalTracerProvider to unit
  • Added graceful error handling for RwLock poisoning with logging instead of panics
  • Replaced mem::replace with direct assignment for consistency with metrics implementation

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
opentelemetry/src/global/trace.rs Modified tracer provider functions to handle errors gracefully and align API with metrics
opentelemetry/CHANGELOG.md Added changelog entry documenting the breaking API change

@codecov
Copy link

codecov bot commented Jul 19, 2025

Codecov Report

Attention: Patch coverage is 0% with 13 lines in your changes missing coverage. Please review.

Project coverage is 80.2%. Comparing base (c5fde17) to head (6cb6a16).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
opentelemetry/src/global/trace.rs 0.0% 11 Missing ⚠️
opentelemetry-sdk/src/trace/runtime_tests.rs 0.0% 2 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #3078   +/-   ##
=====================================
  Coverage   80.1%   80.2%           
=====================================
  Files        126     126           
  Lines      21949   21949           
=====================================
+ Hits       17603   17604    +1     
+ Misses      4346    4345    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andrzejressel andrzejressel changed the title Align global trace with metrics refactor: Align global trace with metrics Jul 19, 2025
@cijothomas cijothomas merged commit 5c1c6da into open-telemetry:main Jul 22, 2025
26 of 27 checks passed
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.

3 participants