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

Stop TracerProvider from being overridden #959

Merged
merged 7 commits into from
Aug 6, 2020

Conversation

ocelotl
Copy link
Contributor

@ocelotl ocelotl commented Jul 29, 2020

Description

The actual behavior allows overriding of the current TracerProvider. Setting of TracerProvider can happen in the auto instrumentation steps and later it can be overridden in application code, causing span processors to be lost.

Fixes #958

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

This PR introduces a change in the following test that asserts that the appropriate warning is raised and that the tracer provider is not overridden even after calling set_tracer_provider twice.

  • opentelemetry-api/tests/trace/test_globals.py:test_tracer_provider_override_warning

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@ocelotl ocelotl requested a review from a team July 29, 2020 22:22
@ocelotl ocelotl self-assigned this Jul 29, 2020
Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

Should this same change be done for the meter provider?

@ocelotl
Copy link
Contributor Author

ocelotl commented Jul 31, 2020

Should this same change be done for the meter provider?

Fixed

@ocelotl ocelotl requested a review from codeboten July 31, 2020 20:57
Copy link
Contributor

@lzchen lzchen left a comment

Choose a reason for hiding this comment

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

Nice!

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

TracerProvider can be overridden
3 participants