Propagation: only warn about oversized baggage headers when headers exist#2212
Merged
owais merged 1 commit intoopen-telemetry:mainfrom Oct 16, 2021
marier-nico:main
Merged
Propagation: only warn about oversized baggage headers when headers exist#2212owais merged 1 commit intoopen-telemetry:mainfrom marier-nico:main
owais merged 1 commit intoopen-telemetry:mainfrom
marier-nico:main
Conversation
|
|
owais
approved these changes
Oct 15, 2021
Contributor
owais
left a comment
There was a problem hiding this comment.
Looks weird to check for if not something and then immediate if something but approving :)
Contributor
Author
|
@owais Yeah, I wasn't sure myself, I tried to go for the smallest change and that was probably not the best idea 😅 Do you think the following would be better? if not header:
return context
if len(header) > self._MAX_HEADER_LENGTH:
_logger.warning(
"Baggage header `%s` exceeded the maximum number of bytes per baggage-string",
header,
)
return context |
Contributor
|
I feel your snippet is more clear and shows the intent of the function better. I'm fine either way. |
Contributor
|
Please add a changelog entry |
This commit makes sure that warnings about the baggage header length are only emitted when the header is actually present, since it does not make sense to warn about a missing header's length.
Contributor
Author
|
Should be all fixed! 😄 |
Contributor
|
Set to auto-merge once it receives a 2nd approval. |
owais
approved these changes
Oct 16, 2021
srikanthccv
approved these changes
Oct 16, 2021
|
You are the savior Thanks a ton for fixing so early. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Warnings were being logged about the baggage header being too long when the header was not present. This PR just adds a check to make sure the warning is only emitted when the header exists.
The main issue is that this was creating a lot of noise in logs, because the project where opentelemetry is used is the first one to receive requests (and thus will never have the baggage header set).
Type of change
How Has This Been Tested?
Tox has been run. I'm not sure much else is necessary, given that no behavior has been changed, only logging.
Does This PR Require a Contrib Repo Change?
Checklist: