-
Notifications
You must be signed in to change notification settings - Fork 624
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
Add create context key to contrib #502
Conversation
CHANGELOG.md
Outdated
@@ -5,7 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | |||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | |||
|
|||
## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.2.0-0.21b0...HEAD) | |||
|
|||
- Added support for CreateKey functionality. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Please include this in the 'Added' section.
from opentelemetry.sdk.trace import Span, SpanProcessor | ||
from opentelemetry.sdk.trace.export import SpanExporter | ||
from opentelemetry.trace import INVALID_TRACE_ID | ||
from opentelemetry.util._time import _time_ns | ||
|
||
logger = logging.getLogger(__name__) | ||
EXPORT_KEY = create_key("suppress_instrumentation") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EXPORT_KEY = create_key("suppress_instrumentation") | |
_SUPPRESS_INSTRUMENTATION_KEY= create_key("suppress_instrumentation") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wanted to confirm my understanding here, the suppress_instrumentation
context key was being utilized previously by the instrumentations to check if somewhere the SDK had set it. But from the looks here, this change updates the code to create separate keys for each instrumentation.
I believe this mean that this change breaks the functionality we currently have where the span process can set the suppress_instrumentation
key before export to prevent the exporter from generating spans. https://github.com/open-telemetry/opentelemetry-python/blob/77c9867dcb0f3179c1b395729aae6aec2c3133a0/opentelemetry-sdk/src/opentelemetry/sdk/trace/export/__init__.py#L89
Can you confirm? If so, we should figure out the right way to move forward to not break this functionality.
Sorry I didn't know the full context behind the What I can do is since in the otel-python PR, I am creating a unique Let me know if you think this is alright! |
Yes, this makes sense 👍 |
5ec1cb5
to
588cffb
Compare
The problem with exporting the key from the SDK is that the instrumentations will then depend on the SDK, which I don't believe they do today. This should likely be part of the API instead, this was discussed in the specification here: open-telemetry/opentelemetry-specification#530 I'll add this to the agenda to discuss it at Thursday's SIG meeting. |
Hm, yeah, good point, @codeboten. I think this is the PR that added the suppress instrumentation key to the API. |
Co-authored-by: Eddy Lin <[email protected]>
2d8d41a
to
f05b9f5
Compare
e1b84bb
to
b4c0f0e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, looks great!
from opentelemetry.trace import StatusCode | ||
|
||
_SUPPRESS_INSTRUMENTATION_KEY = create_key("suppress_instrumentation") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we leave a comment saying that this is a temporary solution, and we are waiting on a decision to how we are handling supressing instrumentations?
bc24d57
to
7f6b893
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just please add the FIXME
, it makes it easier to find stuff that is to be fixed later.
opentelemetry-instrumentation/src/opentelemetry/instrumentation/utils.py
Outdated
Show resolved
Hide resolved
59205e3
to
11b5ece
Compare
2ae3a5d
to
3c8330b
Compare
Description
This PR makes the corresponding changes from otel-python open-telemetry/opentelemetry-python#1372 in the contrib to implement
create_key
functionality as noted here.How Has This Been Tested?
tox
was ran to ensure the new and existing unit tests all pass.