-
Notifications
You must be signed in to change notification settings - Fork 651
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
Adding Correlation Context API and propagator #471
Adding Correlation Context API and propagator #471
Conversation
This change removes Distributed Context and replaces it with the Correlations Context API. Things to do: - add more tests - implement correlation context propagation and add it to the default propagator Signed-off-by: Alex Boten <[email protected]>
18dd676
to
4d595f8
Compare
Codecov Report
@@ Coverage Diff @@
## master #471 +/- ##
==========================================
+ Coverage 89.20% 89.34% +0.14%
==========================================
Files 43 43
Lines 2177 2178 +1
Branches 243 248 +5
==========================================
+ Hits 1942 1946 +4
+ Misses 165 161 -4
- Partials 70 71 +1
Continue to review full report at Codecov.
|
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.
Overall looks good. I'm asking changes due to the fact that correlation context operations are modifying the value stores in the context.
opentelemetry-api/tests/correlationcontext/test_correlation_context.py
Outdated
Show resolved
Hide resolved
opentelemetry-api/src/opentelemetry/correlationcontext/__init__.py
Outdated
Show resolved
Hide resolved
opentelemetry-api/src/opentelemetry/correlationcontext/__init__.py
Outdated
Show resolved
Hide resolved
opentelemetry-api/src/opentelemetry/correlationcontext/__init__.py
Outdated
Show resolved
Hide resolved
opentelemetry-api/src/opentelemetry/correlationcontext/propagation/__init__.py
Outdated
Show resolved
Hide resolved
opentelemetry-api/tests/correlationcontext/test_correlation_context_propagation.py
Outdated
Show resolved
Hide resolved
opentelemetry-api/tests/correlationcontext/test_correlation_context_propagation.py
Outdated
Show resolved
Hide resolved
opentelemetry-api/tests/correlationcontext/test_correlation_context_propagation.py
Show resolved
Hide resolved
opentelemetry-api/tests/correlationcontext/test_correlation_context_propagation.py
Show resolved
Hide resolved
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.
LGTM, thanks for handling all my comments.
See `opentelemetry.trace.propagation.httptextformat.HTTPTextFormat.extract` | ||
""" | ||
|
||
if not context: |
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.
if not context: | |
if context is not None: |
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.
do you mean if context is None
?
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.
changed this to check for None
from opentelemetry.context import get_value, set_value | ||
from opentelemetry.context.context import Context | ||
|
||
CORRELATION_CONTEXT_KEY = "correlation-context" |
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 this be made private?
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.
Done
opentelemetry-api/src/opentelemetry/correlationcontext/propagation/__init__.py
Show resolved
Hide resolved
opentelemetry-api/src/opentelemetry/correlationcontext/propagation/__init__.py
Show resolved
Hide resolved
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.
LGTM, well written and great tests.
Thanks for the reviews! @ocelotl are there anymore blocking changes? |
Total Changelog: Documentations has been significantly overhauled, including: * a getting started guide * examples has been consolidated to an docs/examples folder * several minor improvements to the examples in each extension's readme. - Adding Correlation Context API and propagator ([open-telemetry#471](open-telemetry#471)) - Adding a global configuration module to simplify setting and getting globals ([open-telemetry#466](open-telemetry#466)) - Rename metric handle to bound metric ([open-telemetry#470](open-telemetry#470)) - Moving resources to sdk ([open-telemetry#464](open-telemetry#464)) - Implementing propagators to API to use context ([open-telemetry#446](open-telemetry#446)) - Implement observer instrument for metrics ([open-telemetry#425](open-telemetry#425)) - Adding named meters, removing batchers ([open-telemetry#431](open-telemetry#431)) - Renaming TraceOptions to TraceFlags ([open-telemetry#450](open-telemetry#450)) - Renaming TracerSource to TraceProvider ([open-telemetry#441](open-telemetry#441)) - Adding Correlation Context SDK and propagator ([open-telemetry#471](open-telemetry#471)) - Adding OT Collector metrics exporter ([open-telemetry#454](open-telemetry#454)) - Improve validation of attributes ([open-telemetry#460](open-telemetry#460)) - Re-raise errors caught in opentelemetry.sdk.trace.Tracer.use_span() (open-telemetry#469) ([open-telemetry#469](open-telemetry#469)) - Adding named meters, removing batchers ([open-telemetry#431](open-telemetry#431)) - Make counter and MinMaxSumCount aggregators thread safe ([open-telemetry#439](open-telemetry#439)) - Initial release. Support is included for both trace and metrics.
Total Changelog: Documentations has been significantly overhauled, including: * a getting started guide * examples has been consolidated to an docs/examples folder * several minor improvements to the examples in each extension's readme. - Adding Correlation Context API and propagator ([open-telemetry#471](open-telemetry#471)) - Adding a global configuration module to simplify setting and getting globals ([open-telemetry#466](open-telemetry#466)) - Rename metric handle to bound metric ([open-telemetry#470](open-telemetry#470)) - Moving resources to sdk ([open-telemetry#464](open-telemetry#464)) - Implementing propagators to API to use context ([open-telemetry#446](open-telemetry#446)) - Implement observer instrument for metrics ([open-telemetry#425](open-telemetry#425)) - Adding named meters, removing batchers ([open-telemetry#431](open-telemetry#431)) - Renaming TraceOptions to TraceFlags ([open-telemetry#450](open-telemetry#450)) - Renaming TracerSource to TraceProvider ([open-telemetry#441](open-telemetry#441)) - Adding Correlation Context SDK and propagator ([open-telemetry#471](open-telemetry#471)) - Adding OT Collector metrics exporter ([open-telemetry#454](open-telemetry#454)) - Improve validation of attributes ([open-telemetry#460](open-telemetry#460)) - Re-raise errors caught in opentelemetry.sdk.trace.Tracer.use_span() (open-telemetry#469) ([open-telemetry#469](open-telemetry#469)) - Adding named meters, removing batchers ([open-telemetry#431](open-telemetry#431)) - Make counter and MinMaxSumCount aggregators thread safe ([open-telemetry#439](open-telemetry#439)) - Initial release. Support is included for both trace and metrics.
This change removes Distributed Context and replaces it with the Correlations Context API. This change also adds the Correlation Context Propagator to the global httptextformat propagator.
Fixes #416
Signed-off-by: Alex Boten [email protected]