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

Consistent way of not instrumenting multiple times #549

Merged
merged 36 commits into from
Jul 9, 2021

Conversation

lzchen
Copy link
Contributor

@lzchen lzchen commented Jun 23, 2021

Fixes #439
We use _is_instrumented_by_opentelemetry for all functionality involving indicating whether a component has been instrumented. This is the text that should be used for any context variable/property that is used revolving around determining whether an instrumentation is already instrumented or not.

Another thing to note is the relationship between instrument() and instrument_app/instrument_connection() etc.
instrument_X() should take priority over instrument(), i.e. if uninstrument_app(app) is called after instrument(), app should produce no telemetry.

As well, calling instrument_app(app) after instrument() should not produce double telemetry.

Also a bunch of other consistency-based changes:

  1. Made all instrument/uninstrument_X static methods, where X is a component
  2. fastapi - added uninstrument_app
  3. Changed warning to error on dependency conflict for instrument()

@lzchen lzchen changed the title Consistent way of not instrumenting multiple times [WIP] Consistent way of not instrumenting multiple times Jun 23, 2021
@lzchen lzchen marked this pull request as ready for review June 26, 2021 00:14
@lzchen lzchen requested review from a team, owais and aabmass and removed request for a team June 26, 2021 00:14
@lzchen lzchen changed the title [WIP] Consistent way of not instrumenting multiple times Consistent way of not instrumenting multiple times Jun 26, 2021
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.

We use the string _is_instrumented_by_opentelemetry for all functionality involving indicating whether a component has been instrumented.

@lzchen this statement in the PR description was confusing to me, that variable is a boolean, not a string correct?

@lzchen
Copy link
Contributor Author

lzchen commented Jun 28, 2021

@codeboten
Yes it is a boolean. In the description I was outlining that we are using this specific text_is_instrumented_by_opentelemetry (instead of some other text like is_instrumented) for all things related to instrumenting. I've updated my comment.

@codeboten
Copy link
Contributor

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.

👍 Thanks for addressing my comments

@codeboten codeboten merged commit 56da6d7 into open-telemetry:main Jul 9, 2021
andresbeckruiz pushed a commit to open-o11y/opentelemetry-python-contrib that referenced this pull request Jul 12, 2021
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.

Consistent mechanism to avoid double instrumenting
3 participants