-
Notifications
You must be signed in to change notification settings - Fork 144
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
[Tracing] Refactor internal Span Links API #6341
Conversation
Datadog ReportBranch report: ✅ 0 Failed, 230136 Passed, 2112 Skipped, 18h 9m 42.27s Total Time ⌛ Performance Regressions vs Default Branch (1)
|
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
This PR (6341) - mean (69ms) : 65, 73
. : milestone, 69,
master - mean (68ms) : 66, 71
. : milestone, 68,
section CallTarget+Inlining+NGEN
This PR (6341) - mean (981ms) : 949, 1012
. : milestone, 981,
master - mean (975ms) : 958, 992
. : milestone, 975,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6341) - mean (107ms) : 105, 109
. : milestone, 107,
master - mean (107ms) : 104, 110
. : milestone, 107,
section CallTarget+Inlining+NGEN
This PR (6341) - mean (677ms) : 663, 691
. : milestone, 677,
master - mean (678ms) : 663, 693
. : milestone, 678,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6341) - mean (91ms) : 90, 93
. : milestone, 91,
master - mean (92ms) : 90, 93
. : milestone, 92,
section CallTarget+Inlining+NGEN
This PR (6341) - mean (633ms) : 617, 649
. : milestone, 633,
master - mean (636ms) : 621, 650
. : milestone, 636,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6341) - mean (194ms) : 190, 197
. : milestone, 194,
master - mean (194ms) : 191, 197
. : milestone, 194,
section CallTarget+Inlining+NGEN
This PR (6341) - mean (1,101ms) : 1066, 1136
. : milestone, 1101,
master - mean (1,101ms) : 1069, 1133
. : milestone, 1101,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6341) - mean (279ms) : 273, 285
. : milestone, 279,
master - mean (279ms) : 274, 285
. : milestone, 279,
section CallTarget+Inlining+NGEN
This PR (6341) - mean (869ms) : 838, 901
. : milestone, 869,
master - mean (875ms) : 843, 907
. : milestone, 875,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6341) - mean (267ms) : 262, 273
. : milestone, 267,
master - mean (268ms) : 264, 272
. : milestone, 268,
section CallTarget+Inlining+NGEN
This PR (6341) - mean (853ms) : 817, 889
. : milestone, 853,
master - mean (852ms) : 826, 879
. : milestone, 852,
|
Benchmarks Report for tracer 🐌Benchmarks for #6341 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.StartFinishScope‑net6.0 | 1.234 | 593.56 | 480.81 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StartFinishSpan |
net6.0 | 413ns | 0.199ns | 0.769ns | 0.00802 | 0 | 0 | 576 B |
master | StartFinishSpan |
netcoreapp3.1 | 639ns | 3.5ns | 20.1ns | 0.00752 | 0 | 0 | 576 B |
master | StartFinishSpan |
net472 | 660ns | 0.547ns | 2.12ns | 0.0917 | 0 | 0 | 578 B |
master | StartFinishScope |
net6.0 | 594ns | 0.422ns | 1.63ns | 0.00982 | 0 | 0 | 696 B |
master | StartFinishScope |
netcoreapp3.1 | 745ns | 0.867ns | 3.36ns | 0.00932 | 0 | 0 | 696 B |
master | StartFinishScope |
net472 | 833ns | 1.4ns | 5.41ns | 0.105 | 0 | 0 | 658 B |
#6341 | StartFinishSpan |
net6.0 | 395ns | 0.248ns | 0.96ns | 0.00812 | 0 | 0 | 576 B |
#6341 | StartFinishSpan |
netcoreapp3.1 | 611ns | 0.467ns | 1.81ns | 0.00788 | 0 | 0 | 576 B |
#6341 | StartFinishSpan |
net472 | 626ns | 0.456ns | 1.77ns | 0.0917 | 0 | 0 | 578 B |
#6341 | StartFinishScope |
net6.0 | 480ns | 0.381ns | 1.43ns | 0.00967 | 0 | 0 | 696 B |
#6341 | StartFinishScope |
netcoreapp3.1 | 675ns | 2.47ns | 9.57ns | 0.00936 | 0 | 0 | 696 B |
#6341 | StartFinishScope |
net472 | 883ns | 0.933ns | 3.61ns | 0.104 | 0 | 0 | 658 B |
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | RunOnMethodBegin |
net6.0 | 638ns | 0.866ns | 3.35ns | 0.00963 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
netcoreapp3.1 | 894ns | 0.805ns | 3.12ns | 0.00927 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
net472 | 1.1μs | 1.08ns | 4.18ns | 0.104 | 0 | 0 | 658 B |
#6341 | RunOnMethodBegin |
net6.0 | 649ns | 0.588ns | 2.28ns | 0.00971 | 0 | 0 | 696 B |
#6341 | RunOnMethodBegin |
netcoreapp3.1 | 993ns | 1.18ns | 4.4ns | 0.00941 | 0 | 0 | 696 B |
#6341 | RunOnMethodBegin |
net472 | 1.08μs | 1.11ns | 4.3ns | 0.104 | 0 | 0 | 658 B |
9f2ff65
to
0717792
Compare
Throughput/Crank Report ⚡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 (6341) (11.085M) : 0, 11085165
master (10.945M) : 0, 10944634
benchmarks/2.9.0 (11.033M) : 0, 11032866
section Automatic
This PR (6341) (7.107M) : 0, 7107378
master (7.121M) : 0, 7120888
benchmarks/2.9.0 (7.786M) : 0, 7785853
section Trace stats
master (7.505M) : 0, 7504617
section Manual
master (11.061M) : 0, 11061067
section Manual + Automatic
This PR (6341) (6.594M) : 0, 6594347
master (6.575M) : 0, 6574704
section DD_TRACE_ENABLED=0
master (10.092M) : 0, 10092366
gantt
title Throughput Linux arm64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6341) (9.520M) : 0, 9520408
master (9.576M) : 0, 9576183
benchmarks/2.9.0 (9.495M) : 0, 9494821
section Automatic
This PR (6341) (6.383M) : 0, 6382997
master (6.465M) : 0, 6465361
section Trace stats
master (6.685M) : 0, 6684640
section Manual
master (9.712M) : 0, 9712411
section Manual + Automatic
This PR (6341) (6.025M) : 0, 6024545
master (5.964M) : 0, 5963821
section DD_TRACE_ENABLED=0
master (8.985M) : 0, 8985007
gantt
title Throughput Windows x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6341) (10.344M) : 0, 10344216
master (10.148M) : 0, 10147789
benchmarks/2.9.0 (10.020M) : 0, 10019592
section Automatic
This PR (6341) (6.713M) : 0, 6713488
master (6.790M) : 0, 6790112
benchmarks/2.9.0 (7.255M) : 0, 7255257
section Trace stats
master (7.378M) : 0, 7378293
section Manual
master (10.462M) : 0, 10461699
section Manual + Automatic
This PR (6341) (6.003M) : 0, 6002844
master (6.169M) : 0, 6169080
section DD_TRACE_ENABLED=0
master (9.595M) : 0, 9594713
|
0717792
to
c550991
Compare
c550991
to
f6a9a08
Compare
…erate on SpanContext
…his updated interface is eaiser to use from instrumentations when there are no Spans for incoming headers, only span contexts.
- Rename the method from AddSpanLink to AddLink (this also mirrors the suggestion from OpenTelemetry Tracing API spec) - Return the Span object instead of returning nothing
f6a9a08
to
57db143
Compare
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! Just wanted to make sure that the potential behavior change of removing the IsFinished
check is fine
It seems fine to me, but just wanted to call it out as our SpanLink
is mutable where other implementations don't appear to be so
{ | ||
if (IsFinished) | ||
{ | ||
Log.Warning("AddSpanLink should not be called after the span was closed"); | ||
return null; |
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.
👍
Summary of changes
Updates the internal Datadog API for adding links to span in the following ways:
Datadog.Trace.SpanLink
public SpanLink(SpanContext spanLinkContext, List<KeyValuePair<string, string>>? attributes = null)
Span DecoratedSpan
property: This property and any associated logic has been removedDatadog.Trace.Span
AddSpanLink
: This method now returns the targetSpan
instance for method chainingReason for change
This aligns the API more closely with the OpenTelemetry Tracing API spec, as well as the Activity AddLink API and ActivityLink constructor
Implementation details
Test coverage
The existing unit tests have been updated and any integration tests that add span links are still passing.
Other details