Skip to content

Commit

Permalink
fix: W3C datadog parent state propagation
Browse files Browse the repository at this point in the history
Remove validation on Datadog's W3C tracestate for `p` field.
  • Loading branch information
dmehala committed May 22, 2024
1 parent 622585c commit 2ef1396
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
5 changes: 1 addition & 4 deletions src/datadog/w3c_propagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ Optional<PartiallyParsedTracestate> parse_tracestate(StringView tracestate) {
// - `origin`
// - `trace_tags`
// - `sampling_priority`
// - `datadog_w3c_parent_id`
// - `additional_datadog_w3c_tracestate`
void parse_datadog_tracestate(ExtractedData& result, StringView datadog_value) {
const std::size_t end = datadog_value.size();
Expand Down Expand Up @@ -217,10 +218,6 @@ void parse_datadog_tracestate(ExtractedData& result, StringView datadog_value) {
result.sampling_priority = priority;
}
} else if (key == "p") {
if (value.size() != 16) {
continue;
}

result.datadog_w3c_parent_id = std::string(value);
} else if (starts_with(key, "t.")) {
// The part of the key that follows "t." is the name of a trace tag,
Expand Down
12 changes: 0 additions & 12 deletions test/test_tracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -897,18 +897,6 @@ TEST_CASE("span extraction") {
"00000000000d69ac", // expected_datadog_w3c_parent_id
},

{
__LINE__,
"dd parent id is malformed",
traceparent_drop, // traceparent
"dd=p:XxDDOGxX", // tracestate
0, // expected_sampling_priority
nullopt, // expected_origin
{}, // expected_trace_tags
nullopt, // expected_additional_w3c_tracestate
nullopt, // expected_additional_datadog_w3c_tracestate
"0000000000000000", // expected_datadog_w3c_parent_id,
},
{
__LINE__,
"dd parent id is propagated even if not valid",
Expand Down

0 comments on commit 2ef1396

Please sign in to comment.