Skip to content
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

W3C Phase 3 Extract p Regardless of Order #2385

Merged
merged 17 commits into from
May 15, 2024
Merged

W3C Phase 3 Extract p Regardless of Order #2385

merged 17 commits into from
May 15, 2024

Conversation

link04
Copy link
Contributor

@link04 link04 commented Apr 23, 2024

Motivation

To make sure the traces are following the expected behavior when it comes to extracting the p tag to the spans under the current conditions based on the RFC.

https://docs.google.com/document/d/1Zc7uAQTJ2G5vHEbmx8k4vMnYdQ-BnqZxewXk0ohgd3g/edit#heading=h.53cixy7xk9rp

Changes

Added two new tests to check the created tags when the trace & span Id match and the outcome in scenarios where it doesn't or the tag shouldn't be added.

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes (if something not related to your task is failing, you can ignore it)
  3. Mark it as ready for review
    • Test logic is modified? -> Get a review from RFC owner. We're working on refining the codeowners file quickly.
    • Framework is modified, or non obvious usage of it -> get a review from R&P team

🚀 Once your PR is reviewed, you can merge it!

🛟 #apm-shared-testing 🛟

Reviewer checklist

  • Relevant label (run-parametric-scenario, run-profiling-scenario...) are presents
  • If PR title starts with [<language>], double-check that only <language> is impacted by the change
  • No system-tests internal is modified. Otherwise, I have the approval from R&P team
  • CI is green, or failing jobs are not related to this change (and you are 100% sure about this statement)
  • A docker base image is modified?
    • the relevant build-XXX-image label is present
  • A scenario is added (or removed)?

Copy link
Contributor

@mabdinur mabdinur left a comment

Choose a reason for hiding this comment

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

Overall this looks good but we should keep the tests focused on the w3c phase 3 spec.

tests/parametric/test_headers_tracecontext.py Outdated Show resolved Hide resolved
tests/parametric/test_headers_tracecontext.py Outdated Show resolved Hide resolved
tests/parametric/test_headers_tracecontext.py Outdated Show resolved Hide resolved
tests/parametric/test_headers_tracecontext.py Outdated Show resolved Hide resolved
tests/parametric/test_headers_tracecontext.py Outdated Show resolved Hide resolved
Copy link
Contributor

@bouwkast bouwkast left a comment

Choose a reason for hiding this comment

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

I'm a bit confused with these tests as looking at the RFC it still has two checks for merging headers based on Trace IDs:

  • If 128-bit trace IDs are provided by both headers compare those, merge if equal
  • If it is just 64-bit trace IDs in the headers, compare those, merge if equal

tests/parametric/test_headers_tracecontext.py Outdated Show resolved Hide resolved
tests/parametric/test_headers_tracecontext.py Outdated Show resolved Hide resolved
tests/parametric/test_headers_tracecontext.py Outdated Show resolved Hide resolved
tests/parametric/test_headers_tracecontext.py Outdated Show resolved Hide resolved
Copy link
Contributor

@mabdinur mabdinur left a comment

Choose a reason for hiding this comment

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

The W3C parametric test align with the RFC. We can merge this PR when the tests pass.

@mabdinur mabdinur marked this pull request as ready for review May 14, 2024 20:29
@mabdinur mabdinur requested review from Kyle-Verhoog and a team as code owners May 14, 2024 20:29
This reverts commit a7c369d.
@mabdinur mabdinur merged commit 8c4b0e9 into main May 15, 2024
298 of 300 checks passed
@mabdinur mabdinur deleted the maximo/w3c-phase-3 branch May 15, 2024 16:57
brettlangdon added a commit to DataDog/dd-trace-py that referenced this pull request May 22, 2024
…9254)

## Description

Ensures when trace headers with the same trace_id but different span_ids
are received by an application the tracecontext headers are treated as
the source of truth.
- The traceparent header will be used to set the parent_id
- If the conflicting trace information was extracted from datadog
headers, the span_id from the datadog headers will be stored in the
_dd.parent_id parent_id tag.
- All other propagation styles are third class citizens. If they
conflict with tracecontext headers their span_ids will be overwritten.

This behavior will be validated by the following system-tests:
DataDog/system-tests#2385

## Checklist

- [x] Change(s) are motivated and described in the PR description
- [x] Testing strategy is described if automated tests are not included
in the PR
- [x] Risks are described (performance impact, potential for breakage,
maintainability)
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] [Library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
are followed or label `changelog/no-changelog` is set
- [x] Documentation is included (in-code, generated user docs, [public
corp docs](https://github.com/DataDog/documentation/))
- [x] Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))
- [x] If this PR changes the public interface, I've notified
`@DataDog/apm-tees`.

## Reviewer Checklist

- [x] Title is accurate
- [x] All changes are related to the pull request's stated goal
- [x] Description motivates each change
- [x] Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- [x] Testing strategy adequately addresses listed risks
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] Release note makes sense to a user of the library
- [x] Author has acknowledged and discussed the performance implications
of this PR as reported in the benchmarks PR comment
- [x] Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)

---------

Co-authored-by: Brett Langdon <brett.langdon@datadoghq.com>
link04 added a commit to DataDog/dd-trace-dotnet that referenced this pull request Jul 1, 2024
…ith The W3C Headers (#5721)

## Summary of changes
Making sure that the Parent Id tag is set as expected based on the
confirmation that the TraceIds match but the SpanIds don't when using
the W3C headers, also setting the spanId based on that disconnected to
keep try fixing the parent relation ship.

RFC:
https://docs.google.com/document/d/1Zc7uAQTJ2G5vHEbmx8k4vMnYdQ-BnqZxewXk0ohgd3g/edit

## Reason for change
To improve our interoperability with the `tracecontext` headers.

## Implementation details
Added the following to the SpanContextProgator.cs:
```
if (localSpanContext.RawSpanId != spanContext.RawSpanId)
{
    if (!string.IsNullOrEmpty(spanContext.LastParentId) && spanContext.LastParentId != W3CTraceContextPropagator.ZeroLastParent)
    {
        localSpanContext.LastParentId = spanContext.LastParentId;
    }
    else
    {
        localSpanContext.LastParentId = $"{localSpanContext.SpanId:x16}";
    }

    localSpanContext.SpanId = spanContext.SpanId;
}
``` 
## Test coverage
Added new test case based out of the system-tests cases for this
feature: DataDog/system-tests#2385
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants