Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
WIP: otel baggage support initial PR #10389
base: main
Are you sure you want to change the base?
WIP: otel baggage support initial PR #10389
Changes from 4 commits
d7e6d78
8384630
ce0e420
36d68d3
8adbfd7
e09c681
b739667
19f41fb
4c28ab9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 add test coverage for baggage to
tests/opentelemetry/test_context.py
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.
bump on this, we need a test case. We should use this: https://github.com/open-telemetry/opentelemetry-python/blob/bd51fcb7a3afb08aec975e7302c9cc36060bcacc/opentelemetry-api/src/opentelemetry/baggage/propagation/__init__.py#L29
This test will look similar to: https://github.com/DataDog/dd-trace-py/blob/af9d095c8955e92a318ec78eeb8d9f3143e625c3/tests/opentelemetry/test_trace.py#L162-#L184
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.
Use this to get the baggage set by the propagator: https://github.com/open-telemetry/opentelemetry-python/blob/bd51fcb7a3afb08aec975e7302c9cc36060bcacc/opentelemetry-api/src/opentelemetry/baggage/__init__.py#L53C5-L53C16
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.
We should also make sure the opentelemetry baggage api getters and setters work as expected and create/set/remove values on datadog context objects: https://github.com/open-telemetry/opentelemetry-python/blob/bd51fcb7a3afb08aec975e7302c9cc36060bcacc/opentelemetry-api/src/opentelemetry/baggage/__init__.py#L53-#L117
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.
Same here we should add test coverage for this
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.
⚪ Code Quality Violation
Class _BaggageHeader should have an init method (...read more)
Ensure that a class has an
__init__
method. This check is bypassed when the class is a data class (annotated with @DataClass).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.
Should we raise an unhandled exception if value can not be converted to a string? How should we handle dicts,arrays,booleans,etc. The format needs to be consistent across languages (ex: encoding
True
vstrue
)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.
When "extracting baggage from propagation headers, they may encounter malformed header contents." When this occurs, we "should ignore the entire header." (RFC) So instead of an error, we could potentially just ignore it? As of now, I think it would just do something like a type error
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.
I don't know who errors are handles in Python, but an invalid header should not break the service we are instrumenting. We could definitely log a warning or whatever you usually do in cases like this.
The main point here was that we should not try to extract individual values while ignore that bad ones. If something is wrong, don't try to extract anything. I clear this up in the RFC, thanks.
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.
How should this deconding/unquoting handle errors?
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 handle this outside of the for-loop? baggage should never be the
primary_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.
In the RFC it says that users can also disable other propagation styles (tracecontext or datadog) and enable only the baggage propagator which means baggage could be the
primary_context
in certain cases. Considering this, I think we can leave the code inside the for-loop. Let me know your thoughts because I think there are may be better ways to go about this.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.
🔴 Code Quality Violation
too many nesting levels (...read more)
Avoid to nest too many loops together. Having too many loops make your code harder to understand.
Prefer to organize your code in functions and unit of code you can clearly understand.
Learn More