Skip to content

Commit e2da648

Browse files
ZStriker19mabdinurYun-Kim
authored
chore(w3c): update tracestate tag regex (backport #4827) (#4836)
## Description Right now _dd.propagation_error (and any internal tag that starts with p) will get set as a tracestate tag. With this change, we make sure to only add _dd.p.* tags. ## Checklist - [ ] Followed the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/contributing.html#Release-Note-Guidelines) when writing a release note. - [ ] Add additional sections for `feat` and `fix` pull requests. - [ ] [Library documentation](https://github.com/DataDog/dd-trace-py/tree/1.x/docs) and/or [Datadog's documentation site](https://github.com/DataDog/documentation/) is updated. Link to doc PR in description. <!-- Copy and paste the relevant snippet based on the type of pull request --> <!-- START feat --> ## Motivation <!-- Expand on why the change is required, include relevant context for reviewers --> ## Design <!-- Include benefits from the change as well as possible drawbacks and trade-offs --> ## Testing strategy <!-- Describe the automated tests and/or the steps for manual testing. <!-- END feat --> <!-- START fix --> ## Relevant issue(s) <!-- Link the pull request to any issues related to the fix. Use keywords for links to automate closing the issues once the pull request is merged. --> ## Testing strategy <!-- Describe any added regression tests and/or the manual testing performed. --> <!-- END fix --> ## Reviewer Checklist - [ ] Title is accurate. - [ ] Description motivates each change. - [ ] No unnecessary changes were introduced in this PR. - [ ] Avoid breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [ ] Tests provided or description of manual testing performed is included in the code or PR. - [ ] Release note has been added and follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/contributing.html#Release-Note-Guidelines), or else `changelog/no-changelog` label added. - [ ] All relevant GitHub issues are correctly linked. - [ ] Backports are identified and tagged with Mergifyio. Co-authored-by: Munir Abdinur <[email protected]> Co-authored-by: Yun Kim <[email protected]>
1 parent afb4141 commit e2da648

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

ddtrace/internal/utils/http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def w3c_get_dd_list_member(context):
171171
for k, v in context._meta.items():
172172
if (
173173
isinstance(k, six.string_types)
174-
and k.startswith("_dd.p")
174+
and k.startswith("_dd.p.")
175175
# we've already added sampling decision and user id
176176
and k not in [SAMPLING_DECISION_TRACE_TAG_KEY, USER_ID_KEY]
177177
):

tests/tracer/test_utils.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,19 @@ def _():
418418
),
419419
["s:2", "o:synthetics", "t.unk:-4", "t.unknown:baz64"],
420420
),
421+
(
422+
Context(
423+
trace_id=1234,
424+
sampling_priority=2,
425+
dd_origin="synthetics",
426+
meta={
427+
# we should not propagate _dd.propagation_error, since it does not start with _dd.p.
428+
"_dd.propagation_error": "-4",
429+
"_dd.p.unknown": "baz64",
430+
},
431+
),
432+
["s:2", "o:synthetics", "t.unknown:baz64"],
433+
),
421434
(
422435
Context(
423436
trace_id=1234,
@@ -473,6 +486,7 @@ def _():
473486
],
474487
ids=[
475488
"basic",
489+
"does_not_add_propagation_error",
476490
"does_not_add_non_prefixed_tags",
477491
"does_not_add_more_than_256_char",
478492
"char_replacement",

0 commit comments

Comments
 (0)