-
Notifications
You must be signed in to change notification settings - Fork 19
fix: observe baggage limits on extraction #313
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d97ca08
Add limit checks to baggage extraction as well as injection
zacharycmontoya 6c50e01
Add limit checks to x-datadog-tags extraction as well as injection
zacharycmontoya 76cd980
Run bin/format to fix formatting issues
zacharycmontoya a10afa7
Fix hiding of reader local in unit tests
zacharycmontoya d4c0de6
Address PR feedback
zacharycmontoya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -278,7 +278,9 @@ void parse_datadog_tracestate(ExtractedData& result, StringView datadog_value) { | |
| // `extract_tracestate` populates the `additional_w3c_tracestate` field of | ||
| // `ExtractedData`, in addition to those populated by | ||
| // `parse_datadog_tracestate`. | ||
| void extract_tracestate(ExtractedData& result, const DictReader& headers) { | ||
| void extract_tracestate( | ||
| ExtractedData& result, const DictReader& headers, | ||
| std::unordered_map<std::string, std::string>& span_tags) { | ||
| const auto maybe_tracestate = headers.lookup("tracestate"); | ||
| if (!maybe_tracestate || maybe_tracestate->empty()) { | ||
| return; | ||
|
|
@@ -299,6 +301,13 @@ void extract_tracestate(ExtractedData& result, const DictReader& headers) { | |
| result.additional_w3c_tracestate = std::move(other_entries); | ||
| } | ||
|
|
||
| // If the "dd" vendor entry's value exceeds 512 bytes, drop it and record a | ||
| // propagation error tag. | ||
| if (datadog_value.size() > 512) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI: We only parse and manipulate our section of the W3C tracestate header, so always pass through the entries from other vendors but parse our portion or discard it if it exceeds the configured limits
zacharycmontoya marked this conversation as resolved.
|
||
| span_tags[tags::internal::propagation_error] = "extract_max_size"; | ||
| return; | ||
| } | ||
|
|
||
| parse_datadog_tracestate(result, datadog_value); | ||
| } | ||
|
|
||
|
|
@@ -329,7 +338,7 @@ Expected<ExtractedData> extract_w3c( | |
| } | ||
|
|
||
| result.datadog_w3c_parent_id = "0000000000000000"; | ||
| extract_tracestate(result, headers); | ||
| extract_tracestate(result, headers, span_tags); | ||
|
|
||
| return result; | ||
| } | ||
|
|
||
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.