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

Create Suppress HTTP Instrumentation key in opentelemetry context #2729

Merged

Conversation

carolabadeer
Copy link
Contributor

@carolabadeer carolabadeer commented Jun 2, 2022

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

This change aims to fix the issue outlined in opentelemetry-python-contrib issue #930 where urllib3 downstream spans are not being suppressed with a requests upstream, causing an extra span to be created.

The root cause of this bug lies in the create_key() method in opentelemetry context which adds a unique uuid to the end of each key created. Since a new _SUPPRESS_HTTP_INSTRUMENTATION key is being created in the instrumentation for each library, this results in a different key being created by each instrumentation instead of the creation of a single key that suppresses HTTP instrumentation so proceeding libraries know not to instrument further.

This fix involves creating the _SUPPRESS_HTTP_INSTRUMENTATION once in opentelemetry context to avoid the bug that causes a new suppress http instrumentation key to be created by each instrumentation. By having only 1 key that is accessible to all instrumentations, its true value can be passed on from one instrumentation to the next without being set to None every time the instrumentation of a new library begins. This does not conflict with the context spec since the _SUPPRESS_HTTP_INSTRUMENTATION_KEY is meant to be shared, and creating a unique version of it in each library instrumentation is not the correct implementation of this concept.

Fixes #930 in opentelemetry-python-contrib

Type of change

Please delete options that are not relevant.

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

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Tox unit tests for each affected library (in contrib repo)

Does This PR Require a Contrib Repo Change?

Checklist:

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

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jun 2, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: carolabadeer / name: Carol Abadeer (c828292)

@carolabadeer carolabadeer marked this pull request as ready for review June 7, 2022 23:38
@carolabadeer carolabadeer requested a review from a team June 7, 2022 23:38
@lzchen lzchen merged commit d4d7c67 into open-telemetry:main Jun 16, 2022
eaidland pushed a commit to equinor/omnia-timeseries-python that referenced this pull request Jul 8, 2022
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.

[Regression] urllib3 downstream instrumentation not getting suppressed (with requests, boto3 upstream)
4 participants