-
Notifications
You must be signed in to change notification settings - Fork 140
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
[Tracer] Extracting Last Parent Id If Conflicting SpanIds are Found with The W3C Headers #5721
Conversation
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing the following branches/commits: Execution-time benchmarks measure the whole time it takes to execute a program. And are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are shown in red. The following thresholds were used for comparing the execution times:
Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard. Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph). gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
master - mean (74ms) : 62, 85
. : milestone, 74,
section CallTarget+Inlining+NGEN
master - mean (945ms) : 815, 1075
. : milestone, 945,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
master - mean (120ms) : 111, 130
. : milestone, 120,
section CallTarget+Inlining+NGEN
master - mean (741ms) : 650, 832
. : milestone, 741,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
master - mean (122ms) : 119, 125
. : milestone, 122,
section CallTarget+Inlining+NGEN
master - mean (671ms) : 495, 848
. : milestone, 671,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
master - mean (191ms) : 187, 196
. : milestone, 191,
section CallTarget+Inlining+NGEN
master - mean (1,001ms) : 974, 1028
. : milestone, 1001,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
master - mean (276ms) : 273, 280
. : milestone, 276,
section CallTarget+Inlining+NGEN
master - mean (823ms) : 798, 849
. : milestone, 823,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
master - mean (265ms) : 262, 269
. : milestone, 265,
section CallTarget+Inlining+NGEN
master - mean (809ms) : 780, 839
. : milestone, 809,
|
Throughput/Crank Report:zap:Throughput results for AspNetCoreSimpleController comparing the following branches/commits: Cases where throughput results for the PR are worse than latest master (5% drop or greater), results are shown in red. Note that these results are based on a single point-in-time result for each branch. For full results, see one of the many, many dashboards! gantt
title Throughput Linux x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (5721) (11.955M) : 0, 11955107
master (11.842M) : 0, 11842369
benchmarks/2.9.0 (12.049M) : 0, 12048905
section Automatic
This PR (5721) (7.897M) : 0, 7896532
master (7.999M) : 0, 7998666
benchmarks/2.9.0 (8.464M) : 0, 8463997
section Trace stats
master (8.337M) : 0, 8336641
section Manual
This PR (5721) (10.141M) : 0, 10140964
master (10.173M) : 0, 10173108
section Manual + Automatic
This PR (5721) (7.475M) : 0, 7474503
master (7.350M) : 0, 7349541
section Version Conflict
master (6.703M) : 0, 6702940
gantt
title Throughput Linux arm64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (5721) (9.591M) : 0, 9590887
master (9.512M) : 0, 9511621
benchmarks/2.9.0 (9.590M) : 0, 9590349
section Automatic
This PR (5721) (6.569M) : 0, 6569301
master (6.515M) : 0, 6515399
section Trace stats
master (6.862M) : 0, 6861752
section Manual
This PR (5721) (8.182M) : 0, 8181694
master (8.299M) : 0, 8298527
section Manual + Automatic
This PR (5721) (6.269M) : 0, 6269343
master (6.262M) : 0, 6262373
section Version Conflict
master (5.588M) : 0, 5588112
gantt
title Throughput Windows x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (5721) (10.263M) : 0, 10263454
master (10.162M) : 0, 10161696
benchmarks/2.9.0 (10.465M) : 0, 10465033
section Automatic
This PR (5721) (7.290M) : 0, 7290428
master (7.293M) : 0, 7293498
benchmarks/2.9.0 (7.635M) : 0, 7635248
section Trace stats
master (7.497M) : 0, 7496532
section Manual
This PR (5721) (8.976M) : 0, 8975771
master (9.243M) : 0, 9243291
section Manual + Automatic
This PR (5721) (7.050M) : 0, 7049924
master (6.976M) : 0, 6975655
section Version Conflict
master (6.267M) : 0, 6266553
|
Benchmarks Report for tracer 🐌Benchmarks for #5721 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SpanBenchmark - Faster 🎉 Same allocations ✔️
|
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net472 | 1.127 | 707.50 | 627.96 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StartFinishSpan |
net6.0 | 391ns | 0.306ns | 1.19ns | 0.00814 | 0 | 0 | 576 B |
master | StartFinishSpan |
netcoreapp3.1 | 585ns | 0.328ns | 1.18ns | 0.00798 | 0 | 0 | 576 B |
master | StartFinishSpan |
net472 | 707ns | 0.37ns | 1.39ns | 0.0916 | 0 | 0 | 578 B |
master | StartFinishScope |
net6.0 | 550ns | 0.307ns | 1.19ns | 0.00963 | 0 | 0 | 696 B |
master | StartFinishScope |
netcoreapp3.1 | 742ns | 0.806ns | 2.91ns | 0.00932 | 0 | 0 | 696 B |
master | StartFinishScope |
net472 | 868ns | 0.845ns | 3.27ns | 0.104 | 0 | 0 | 658 B |
#5721 | StartFinishSpan |
net6.0 | 406ns | 0.127ns | 0.491ns | 0.00817 | 0 | 0 | 576 B |
#5721 | StartFinishSpan |
netcoreapp3.1 | 558ns | 0.613ns | 2.37ns | 0.00787 | 0 | 0 | 576 B |
#5721 | StartFinishSpan |
net472 | 629ns | 0.542ns | 2.1ns | 0.0916 | 0 | 0 | 578 B |
#5721 | StartFinishScope |
net6.0 | 545ns | 0.29ns | 1.12ns | 0.0098 | 0 | 0 | 696 B |
#5721 | StartFinishScope |
netcoreapp3.1 | 704ns | 0.24ns | 0.929ns | 0.00949 | 0 | 0 | 696 B |
#5721 | StartFinishScope |
net472 | 894ns | 0.535ns | 1.85ns | 0.104 | 0 | 0 | 658 B |
Benchmarks.Trace.TraceAnnotationsBenchmark - Slower ⚠️ Same allocations ✔️
Slower ⚠️ in #5721
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0
1.185
633.60
750.61
Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 | 1.185 | 633.60 | 750.61 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | RunOnMethodBegin |
net6.0 | 634ns | 0.122ns | 0.455ns | 0.00984 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
netcoreapp3.1 | 912ns | 2.94ns | 11.4ns | 0.0092 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
net472 | 1.06μs | 0.971ns | 3.76ns | 0.104 | 0 | 0 | 658 B |
#5721 | RunOnMethodBegin |
net6.0 | 751ns | 0.62ns | 2.4ns | 0.00963 | 0 | 0 | 696 B |
#5721 | RunOnMethodBegin |
netcoreapp3.1 | 916ns | 0.439ns | 1.7ns | 0.00953 | 0 | 0 | 696 B |
#5721 | RunOnMethodBegin |
net472 | 1.07μs | 0.497ns | 1.92ns | 0.104 | 0 | 0 | 658 B |
…ace-dotnet into maximo/w3c-phase-3
Datadog ReportBranch report: ✅ 0 Failed, 339424 Passed, 1624 Skipped, 14h 17m 29.29s Total Time |
tracer/test/Datadog.Trace.Tests/Propagators/MultiSpanContextPropagatorTests.cs
Outdated
Show resolved
Hide resolved
tracer/test/Datadog.Trace.Tests/Propagators/MultiSpanContextPropagatorTests.cs
Show resolved
Hide resolved
@@ -199,7 +199,7 @@ private SpanContext(TraceId traceId, string serviceName) | |||
/// <summary> | |||
/// Gets the span id. | |||
/// </summary> | |||
public ulong SpanId { get; } | |||
public ulong SpanId { get; internal set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels iffy. Why are we adding a property setter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So part of the W3C Phase 3 is the future deprecation of Datadog headers, so when we find conflicting headers we prioritize W3C span id and need to update them, in the latest commit I do so like:
fdd4fd5#diff-3f905f6ce54156702b562c581f1ff7866c41fbafb6b29b79c6c2411c79c19e55R187-R188
localSpanContext.SpanId = spanContext.SpanId;
localSpanContext.RawSpanId = spanContext.RawSpanId;
Do you have any other prefer methods, I Googled the internal
set and found no complaints so far.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, this is SpanContext
. I thought this was Span
. 😅
Still, it would've been nice to mutate things as little as possible. Maybe determine the final span id first before creating the SpanContext
, but that's a larger refactor.
Thanks for clarifying.
@@ -64,7 +64,7 @@ internal class SpanMessagePackFormatter : IMessagePackFormatter<TraceChunkModel> | |||
private readonly byte[] _versionNameBytes = StringEncoding.UTF8.GetBytes(Trace.Tags.Version); | |||
|
|||
private readonly byte[] _originNameBytes = StringEncoding.UTF8.GetBytes(Trace.Tags.Origin); | |||
private readonly byte[] _lastParentIdBytes = StringEncoding.UTF8.GetBytes("_dd.parent_id"); | |||
private readonly byte[] _lastParentIdBytes = StringEncoding.UTF8.GetBytes(Trace.Tags.LastParentId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, good work!
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:
Test coverage
Added new test case based out of the system-tests cases for this feature: DataDog/system-tests#2385