Skip to content

WIP: [rust]: enable rust endpoints for baggage#6686

Open
rachelyangdog wants to merge 1 commit intomainfrom
rachel.yang/rust-baggage-endpoints
Open

WIP: [rust]: enable rust endpoints for baggage#6686
rachelyangdog wants to merge 1 commit intomainfrom
rachel.yang/rust-baggage-endpoints

Conversation

@rachelyangdog
Copy link
Copy Markdown
Contributor

Motivation

Changes

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes
  3. Mark it as ready for review
    • Test logic is modified? -> Get a review from RFC owner.
    • Framework is modified, or non obvious usage of it -> get a review from R&P team

🚀 Once your PR is reviewed and the CI green, you can merge it!

🛟 #apm-shared-testing 🛟

Reviewer checklist

  • Anything but tests/ or manifests/ is modified ? I have the approval from R&P team
  • A docker base image is modified?
    • the relevant build-XXX-image label is present
  • A scenario is added, removed or renamed?

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

CODEOWNERS have been resolved as:

manifests/rust.yml                                                      @DataDog/apm-rust
utils/build/docker/rust/parametric/src/datadog/mod.rs                   @DataDog/apm-rust @DataDog/system-tests-core

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 846d3cd9e4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

.context
.baggage()
.iter()
.map(|(k, (v, _))| (decode_baggage_key(k.as_str()), v.as_str().to_string()))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid decoding literal %HH sequences in baggage keys

get_all_baggage always runs decode_baggage_key on every key, which means a valid literal key like user%2Fid is returned as user/id. This is lossy and can also collapse distinct keys (e.g., a/b and a%2Fb) into one map entry, silently dropping baggage data. The issue appears whenever callers use % followed by hex digits in a key, which is allowed by is_tchar and therefore currently stored unescaped.

Useful? React with 👍 / 👎.

Comment on lines +491 to +493
if ctx.context.get::<BaggageOverflowed>().is_some() {
debug!("set_baggage: baggage overflow flag set, skipping");
return;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reset overflow guard after remove_all_baggage

After one overflow, set_baggage permanently returns early because it checks BaggageOverflowed in the context; however, remove_all_baggage only clears baggage entries and does not clear that sentinel. As a result, once a span exceeds limits, later remove_all_baggage + set_baggage on the same span cannot recover and all future writes are dropped.

Useful? React with 👍 / 👎.

@datadog-prod-us1-5
Copy link
Copy Markdown

datadog-prod-us1-5 bot commented Apr 3, 2026

⚠️ Tests

Fix all issues with BitsAI or with Cursor

⚠️ Warnings

🧪 12 Tests failed

tests.parametric.test_headers_baggage.Test_Headers_Baggage.test_baggage_extract_header_D005[parametric-rust] from system_tests_suite   View in Datadog   (Fix with Cursor)
AssertionError: assert None == 'bar'
 +  where None = <bound method _TestSpan.get_baggage of <utils.docker_fixtures._test_clients._test_client_parametric._TestSpan object at 0x7ff5453f4890>>('foo')
 +    where <bound method _TestSpan.get_baggage of <utils.docker_fixtures._test_clients._test_client_parametric._TestSpan object at 0x7ff5453f4890>> = <utils.docker_fixtures._test_clients._test_client_parametric._TestSpan object at 0x7ff5453f4890>.get_baggage

self = <tests.parametric.test_headers_baggage.Test_Headers_Baggage object at 0x7ff57a1a6690>
test_library = <utils.docker_fixtures._test_clients._test_client_parametric.ParametricTestClientApi object at 0x7ff5454363f0>

    def test_baggage_extract_header_D005(self, test_library: APMLibrary) -> None:
        """Testing baggage header extraction and decoding"""
    
...
tests.parametric.test_headers_baggage.Test_Headers_Baggage.test_baggage_get_all_D009[parametric-rust] from system_tests_suite   View in Datadog   (Fix with Cursor)
AssertionError: assert {'baz': 'qux'...Id': 'Amélie'} == {'baz': 'qux'...Id': 'Amélie'}
  Omitting 3 identical items, use -vv to show
  Right contains 1 more item:
  {'foo': 'bar'}
  Full diff:
  - {'baz': 'qux', 'foo': 'bar', 'serverNode': 'DF 28', 'userId': 'Amélie'}
  ?               --------------
  + {'baz': 'qux', 'serverNode': 'DF 28', 'userId': 'Amélie'}

self = <tests.parametric.test_headers_baggage.Test_Headers_Baggage object at 0x7f4f95f2e240>
...
tests.parametric.test_headers_baggage.Test_Headers_Baggage.test_baggage_get_D008[parametric-rust] from system_tests_suite   View in Datadog   (Fix with Cursor)
AssertionError: assert None == 'Amélie'
 +  where None = <bound method _TestSpan.get_baggage of <utils.docker_fixtures._test_clients._test_client_parametric._TestSpan object at 0x7f4f616a2090>>('userId')
 +    where <bound method _TestSpan.get_baggage of <utils.docker_fixtures._test_clients._test_client_parametric._TestSpan object at 0x7f4f616a2090>> = <utils.docker_fixtures._test_clients._test_client_parametric._TestSpan object at 0x7f4f616a2090>.get_baggage

self = <tests.parametric.test_headers_baggage.Test_Headers_Baggage object at 0x7f4f95f2fa10>
test_library = <utils.docker_fixtures._test_clients._test_client_parametric.ParametricTestClientApi object at 0x7f4f616a3890>

    def test_baggage_get_D008(self, test_library: APMLibrary) -> None:
        """Testing baggage API get_baggage"""
        with test_library.dd_extract_headers_and_make_child_span(
...
View all

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 846d3cd | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

tests/parametric/test_headers_baggage.py::Test_Headers_Baggage::test_baggageheader_maxitems_inject_D016: missing_feature # Created by easy win activation script
tests/parametric/test_headers_baggage.py::Test_Headers_Baggage::test_headers_baggage_default_D001: missing_feature # Created by easy win activation script
tests/parametric/test_headers_baggage.py::Test_Headers_Baggage::test_headers_baggage_only_D002: missing_feature # Created by easy win activation script
# tests/parametric/test_headers_baggage.py::Test_Headers_Baggage: '>=0.2.1' # Modified by easy win activation script
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If those line are not needed, could you remove them ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants