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

[Tracing] Add IsRemote to SpanContext #5385

Merged
merged 4 commits into from
Apr 9, 2024
Merged

[Tracing] Add IsRemote to SpanContext #5385

merged 4 commits into from
Apr 9, 2024

Conversation

bouwkast
Copy link
Contributor

@bouwkast bouwkast commented Apr 2, 2024

Summary of changes

This adds IsRemote to SpanContext that will be set to true whenever that context originated from some distributed context via some IContextExtractor.

Reason for change

Needed a way to easily discern whether a SpanContext was originated from a remote context or from a local one and this seems to be a good way of doing it.

Alternatively, I think it is intentional that creating a SpanContext without a parent SpanContext is intended to be a "remote" context, but that isn't actually guaranteed, so this seemed better (I think)

Implementation details

Added IsRemote to SpanContext
For each of the IContextExtractors, added a IsRemote = true to the SpanContext that is extracted in the TryExtract method.

Test coverage

  • Updated tests.

Other details

@bouwkast bouwkast requested a review from a team as a code owner April 2, 2024 20:10
@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Apr 2, 2024

Datadog Report

Branch report: steven/is-remote
Commit report: 41cb7a3
Test service: dd-trace-dotnet

✅ 0 Failed, 329839 Passed, 1581 Skipped, 40m 32.38s Wall Time
❄️ 1 New Flaky

New Flaky Tests (1)

  • RefParametersMethods - Datadog.Trace.DuckTyping.Tests.Methods.MethodTests - Last Failure

    Expand for error
     Bad binary signature. (Exception from HRESULT: 0x80131192)
    

@andrewlock
Copy link
Member

andrewlock commented Apr 2, 2024

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:

  • Welch test with statistical test for significance of 5%
  • Only results indicating a difference greater than 5% and 5 ms are considered.

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 (5385) - mean (73ms)  : 65, 81
     .   : milestone, 73,
    master - mean (74ms)  : 66, 82
     .   : milestone, 74,

    section CallTarget+Inlining+NGEN
    This PR (5385) - mean (990ms)  : 966, 1013
     .   : milestone, 990,
    master - mean (999ms)  : 982, 1016
     .   : milestone, 999,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5385) - mean (109ms)  : 105, 112
     .   : milestone, 109,
    master - mean (109ms)  : 106, 111
     .   : milestone, 109,

    section CallTarget+Inlining+NGEN
    This PR (5385) - mean (706ms)  : 682, 731
     .   : milestone, 706,
    master - mean (717ms)  : 694, 740
     .   : milestone, 717,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5385) - mean (93ms)  : 91, 96
     .   : milestone, 93,
    master - mean (93ms)  : 90, 95
     .   : milestone, 93,

    section CallTarget+Inlining+NGEN
    This PR (5385) - mean (673ms)  : 648, 697
     .   : milestone, 673,
    master - mean (678ms)  : 653, 704
     .   : milestone, 678,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5385) - mean (186ms)  : 183, 190
     .   : milestone, 186,
    master - mean (187ms)  : 182, 191
     .   : milestone, 187,

    section CallTarget+Inlining+NGEN
    This PR (5385) - mean (1,072ms)  : 1043, 1101
     .   : milestone, 1072,
    master - mean (1,070ms)  : 1043, 1097
     .   : milestone, 1070,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5385) - mean (269ms)  : 262, 277
     .   : milestone, 269,
    master - mean (270ms)  : 264, 276
     .   : milestone, 270,

    section CallTarget+Inlining+NGEN
    This PR (5385) - mean (865ms)  : 842, 888
     .   : milestone, 865,
    master - mean (868ms)  : 847, 890
     .   : milestone, 868,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5385) - mean (258ms)  : 252, 265
     .   : milestone, 258,
    master - mean (258ms)  : 253, 264
     .   : milestone, 258,

    section CallTarget+Inlining+NGEN
    This PR (5385) - mean (849ms)  : 828, 870
     .   : milestone, 849,
    master - mean (850ms)  : 824, 876
     .   : milestone, 850,

Loading

@andrewlock
Copy link
Member

andrewlock commented Apr 2, 2024

Benchmarks Report for tracer 🐌

Benchmarks for #5385 compared to master:

  • 3 benchmarks are slower, with geometric mean 1.190
  • 34 benchmarks have more allocations

The following thresholds were used for comparing the benchmark speeds:

  • Mann–Whitney U test with statistical test for significance of 5%
  • Only results indicating a difference greater than 10% and 0.3 ns are considered.

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 8.89μs 47.9ns 279ns 0.0272 0.00906 0 7.5 KB
master StartStopWithChild netcoreapp3.1 11μs 59ns 318ns 0.0258 0.0103 0 7.6 KB
master StartStopWithChild net472 16.9μs 61.8ns 240ns 1.34 0.327 0.103 8.05 KB
#5385 StartStopWithChild net6.0 8.62μs 47.6ns 289ns 0.0328 0.0164 0 7.52 KB
#5385 StartStopWithChild netcoreapp3.1 10.4μs 47.3ns 171ns 0.0264 0.0105 0 7.61 KB
#5385 StartStopWithChild net472 16.7μs 75.9ns 294ns 1.35 0.354 0.107 8.05 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 465μs 114ns 426ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 610μs 167ns 645ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 806μs 353ns 1.32μs 0.408 0 0 3.3 KB
#5385 WriteAndFlushEnrichedTraces net6.0 459μs 368ns 1.38μs 0 0 0 2.7 KB
#5385 WriteAndFlushEnrichedTraces netcoreapp3.1 615μs 191ns 716ns 0 0 0 2.7 KB
#5385 WriteAndFlushEnrichedTraces net472 813μs 247ns 955ns 0.403 0 0 3.3 KB
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 173μs 262ns 1.02μs 0.173 0 0 18.33 KB
master SendRequest netcoreapp3.1 189μs 352ns 1.36μs 0.19 0 0 20.49 KB
master SendRequest net472 0.000622ns 0.000235ns 0.000846ns 0 0 0 0 b
#5385 SendRequest net6.0 172μs 168ns 651ns 0.169 0 0 18.35 KB
#5385 SendRequest netcoreapp3.1 192μs 177ns 663ns 0.191 0 0 20.51 KB
#5385 SendRequest net472 0.000809ns 0.000275ns 0.00106ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #5385

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 41.47 KB 41.78 KB 306 B 0.74%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 536μs 924ns 3.46μs 0.553 0 0 41.47 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 659μs 758ns 2.94μs 0.334 0 0 41.78 KB
master WriteAndFlushEnrichedTraces net472 854μs 3.59μs 13.9μs 8.28 2.48 0.414 53.26 KB
#5385 WriteAndFlushEnrichedTraces net6.0 535μs 390ns 1.51μs 0.536 0 0 41.78 KB
#5385 WriteAndFlushEnrichedTraces netcoreapp3.1 667μs 575ns 1.99μs 0.336 0 0 41.78 KB
#5385 WriteAndFlushEnrichedTraces net472 871μs 4.23μs 16.9μs 8.39 2.52 0.419 53.26 KB
Benchmarks.Trace.DbCommandBenchmark - Slower ⚠️ More allocations ⚠️

Slower ⚠️ in #5385

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑net6.0 1.141 1,058.79 1,208.31

More allocations ⚠️ in #5385

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑net472 746 B 754 B 8 B 1.07%
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑net6.0 784 B 792 B 8 B 1.02%
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑netcoreapp3.1 784 B 792 B 8 B 1.02%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 1.06μs 0.319ns 1.1ns 0.0111 0 0 784 B
master ExecuteNonQuery netcoreapp3.1 1.53μs 1.3ns 5.04ns 0.0107 0 0 784 B
master ExecuteNonQuery net472 1.74μs 1.53ns 5.93ns 0.118 0 0 746 B
#5385 ExecuteNonQuery net6.0 1.21μs 0.697ns 2.7ns 0.0108 0 0 792 B
#5385 ExecuteNonQuery netcoreapp3.1 1.57μs 0.563ns 2.18ns 0.0103 0 0 792 B
#5385 ExecuteNonQuery net472 1.86μs 1.45ns 5.61ns 0.12 0 0 754 B
Benchmarks.Trace.ElasticsearchBenchmark - Slower ⚠️ More allocations ⚠️

Slower ⚠️ in #5385

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net6.0 1.151 1,203.87 1,385.31

More allocations ⚠️ in #5385

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑net6.0 984 B 992 B 8 B 0.81%
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net6.0 1.01 KB 1.02 KB 8 B 0.79%
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑netcoreapp3.1 1.01 KB 1.02 KB 8 B 0.79%
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net472 1.02 KB 1.03 KB 8 B 0.79%
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑netcoreapp3.1 1.06 KB 1.06 KB 8 B 0.76%
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑net472 1.08 KB 1.08 KB 8 B 0.74%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.2μs 0.498ns 1.93ns 0.0142 0 0 1.01 KB
master CallElasticsearch netcoreapp3.1 1.63μs 1.14ns 4.41ns 0.0138 0 0 1.01 KB
master CallElasticsearch net472 2.52μs 1.55ns 6ns 0.161 0.00127 0 1.02 KB
master CallElasticsearchAsync net6.0 1.35μs 0.598ns 2.31ns 0.0135 0 0 984 B
master CallElasticsearchAsync netcoreapp3.1 1.65μs 0.647ns 2.42ns 0.014 0 0 1.06 KB
master CallElasticsearchAsync net472 2.67μs 1.27ns 4.91ns 0.17 0 0 1.08 KB
#5385 CallElasticsearch net6.0 1.39μs 0.76ns 2.84ns 0.0136 0 0 1.02 KB
#5385 CallElasticsearch netcoreapp3.1 1.56μs 0.465ns 1.74ns 0.0139 0 0 1.02 KB
#5385 CallElasticsearch net472 2.5μs 1.2ns 4.48ns 0.163 0 0 1.03 KB
#5385 CallElasticsearchAsync net6.0 1.36μs 0.948ns 3.55ns 0.0139 0 0 992 B
#5385 CallElasticsearchAsync netcoreapp3.1 1.8μs 1.02ns 3.83ns 0.0143 0 0 1.06 KB
#5385 CallElasticsearchAsync net472 2.7μs 0.817ns 3.06ns 0.172 0 0 1.08 KB
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #5385

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net472 891 B 899 B 8 B 0.90%
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net6.0 928 B 936 B 8 B 0.86%
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑netcoreapp3.1 928 B 936 B 8 B 0.86%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net6.0 1.31μs 0.762ns 2.64ns 0.0132 0 0 928 B
master ExecuteAsync netcoreapp3.1 1.65μs 1.57ns 6.08ns 0.0125 0 0 928 B
master ExecuteAsync net472 1.88μs 0.922ns 3.57ns 0.141 0 0 891 B
#5385 ExecuteAsync net6.0 1.33μs 1.06ns 3.66ns 0.0131 0 0 936 B
#5385 ExecuteAsync netcoreapp3.1 1.75μs 0.751ns 2.81ns 0.0123 0 0 936 B
#5385 ExecuteAsync net472 1.92μs 1.76ns 6.8ns 0.142 0 0 899 B
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendAsync net6.0 4.12μs 2.4ns 9.29ns 0.029 0 0 2.16 KB
master SendAsync netcoreapp3.1 5.11μs 2.47ns 9.24ns 0.0358 0 0 2.7 KB
master SendAsync net472 7.67μs 3.28ns 12.7ns 0.482 0 0 3.05 KB
#5385 SendAsync net6.0 4.1μs 3.97ns 14.9ns 0.0307 0 0 2.17 KB
#5385 SendAsync netcoreapp3.1 5.07μs 3.01ns 11.3ns 0.0358 0 0 2.7 KB
#5385 SendAsync net472 7.6μs 7.75ns 30ns 0.483 0 0 3.06 KB
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #5385

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ILoggerBenchmark.EnrichedLog‑net472 1.57 KB 1.59 KB 16 B 1.02%
Benchmarks.Trace.ILoggerBenchmark.EnrichedLog‑net6.0 1.65 KB 1.66 KB 16 B 0.97%
Benchmarks.Trace.ILoggerBenchmark.EnrichedLog‑netcoreapp3.1 1.65 KB 1.66 KB 16 B 0.97%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 1.46μs 0.601ns 2.25ns 0.0228 0 0 1.65 KB
master EnrichedLog netcoreapp3.1 2.2μs 0.99ns 3.83ns 0.0219 0 0 1.65 KB
master EnrichedLog net472 2.68μs 1.85ns 6.93ns 0.249 0 0 1.57 KB
#5385 EnrichedLog net6.0 1.52μs 0.698ns 2.61ns 0.0236 0 0 1.66 KB
#5385 EnrichedLog netcoreapp3.1 2.4μs 1.01ns 3.76ns 0.0228 0 0 1.66 KB
#5385 EnrichedLog net472 2.59μs 1.53ns 5.71ns 0.252 0 0 1.59 KB
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 114μs 158ns 592ns 0 0 0 4.23 KB
master EnrichedLog netcoreapp3.1 119μs 247ns 956ns 0.059 0 0 4.23 KB
master EnrichedLog net472 146μs 132ns 475ns 0.657 0.219 0 4.41 KB
#5385 EnrichedLog net6.0 112μs 102ns 394ns 0 0 0 4.25 KB
#5385 EnrichedLog netcoreapp3.1 118μs 198ns 714ns 0.0584 0 0 4.25 KB
#5385 EnrichedLog net472 148μs 93.1ns 348ns 0.661 0.22 0 4.43 KB
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #5385

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.NLogBenchmark.EnrichedLog‑net472 2.02 KB 2.04 KB 16 B 0.79%
Benchmarks.Trace.NLogBenchmark.EnrichedLog‑net6.0 2.21 KB 2.22 KB 16 B 0.73%
Benchmarks.Trace.NLogBenchmark.EnrichedLog‑netcoreapp3.1 2.21 KB 2.22 KB 16 B 0.73%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 3μs 1.07ns 4.02ns 0.0299 0 0 2.21 KB
master EnrichedLog netcoreapp3.1 4.34μs 2.48ns 9.29ns 0.03 0 0 2.21 KB
master EnrichedLog net472 5.02μs 1.07ns 3.7ns 0.32 0 0 2.02 KB
#5385 EnrichedLog net6.0 2.99μs 1.41ns 5.46ns 0.0314 0 0 2.22 KB
#5385 EnrichedLog netcoreapp3.1 4.34μs 2.2ns 8.52ns 0.0282 0 0 2.22 KB
#5385 EnrichedLog net472 5.07μs 3.89ns 15.1ns 0.321 0 0 2.04 KB
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #5385

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.RedisBenchmark.SendReceive‑net472 1.18 KB 1.19 KB 9 B 0.76%
Benchmarks.Trace.RedisBenchmark.SendReceive‑net6.0 1.18 KB 1.18 KB 8 B 0.68%
Benchmarks.Trace.RedisBenchmark.SendReceive‑netcoreapp3.1 1.18 KB 1.18 KB 8 B 0.68%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net6.0 1.46μs 0.845ns 3.16ns 0.016 0 0 1.18 KB
master SendReceive netcoreapp3.1 1.89μs 1.66ns 6.41ns 0.0161 0 0 1.18 KB
master SendReceive net472 2.38μs 1.34ns 5.19ns 0.187 0 0 1.18 KB
#5385 SendReceive net6.0 1.48μs 0.535ns 2ns 0.0163 0 0 1.18 KB
#5385 SendReceive netcoreapp3.1 1.76μs 1.04ns 4.02ns 0.016 0 0 1.18 KB
#5385 SendReceive net472 2.26μs 3.3ns 12.4ns 0.188 0.00111 0 1.19 KB
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #5385

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.SerilogBenchmark.EnrichedLog‑net6.0 1.55 KB 1.57 KB 16 B 1.03%
Benchmarks.Trace.SerilogBenchmark.EnrichedLog‑netcoreapp3.1 1.6 KB 1.62 KB 16 B 1.00%
Benchmarks.Trace.SerilogBenchmark.EnrichedLog‑net472 1.99 KB 2.01 KB 16 B 0.80%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 2.8μs 0.757ns 2.93ns 0.0222 0 0 1.55 KB
master EnrichedLog netcoreapp3.1 4.06μs 6.13ns 23.8ns 0.022 0 0 1.6 KB
master EnrichedLog net472 4.43μs 2.04ns 7.89ns 0.315 0 0 1.99 KB
#5385 EnrichedLog net6.0 2.84μs 0.767ns 2.87ns 0.0226 0 0 1.57 KB
#5385 EnrichedLog netcoreapp3.1 3.95μs 1.6ns 6.21ns 0.0216 0 0 1.62 KB
#5385 EnrichedLog net472 4.45μs 2ns 7.75ns 0.317 0 0 2.01 KB
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ More allocations ⚠️

Slower ⚠️ in #5385

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 1.282 455.61 584.13

More allocations ⚠️ in #5385

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 552 B 560 B 8 B 1.45%
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 552 B 560 B 8 B 1.45%
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net472 554 B 562 B 8 B 1.44%
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net472 634 B 642 B 8 B 1.26%
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 672 B 680 B 8 B 1.19%
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑netcoreapp3.1 672 B 680 B 8 B 1.19%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 458ns 1.66ns 6.45ns 0.00769 0 0 552 B
master StartFinishSpan netcoreapp3.1 764ns 1.12ns 4.35ns 0.0075 0 0 552 B
master StartFinishSpan net472 784ns 1.16ns 4.49ns 0.0878 0 0 554 B
master StartFinishScope net6.0 635ns 0.944ns 3.4ns 0.00946 0 0 672 B
master StartFinishScope netcoreapp3.1 891ns 1.61ns 6.23ns 0.00912 0 0 672 B
master StartFinishScope net472 1.01μs 1.13ns 4.36ns 0.1 0 0 634 B
#5385 StartFinishSpan net6.0 584ns 0.735ns 2.85ns 0.0077 0 0 560 B
#5385 StartFinishSpan netcoreapp3.1 699ns 2.22ns 8.32ns 0.00754 0 0 560 B
#5385 StartFinishSpan net472 780ns 1.56ns 6.03ns 0.0891 0 0 562 B
#5385 StartFinishScope net6.0 663ns 1.58ns 5.68ns 0.00934 0 0 680 B
#5385 StartFinishScope netcoreapp3.1 900ns 0.79ns 3.06ns 0.00933 0 0 680 B
#5385 StartFinishScope net472 987ns 2.49ns 9.64ns 0.102 0 0 642 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #5385

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net472 634 B 642 B 8 B 1.26%
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 672 B 680 B 8 B 1.19%
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑netcoreapp3.1 672 B 680 B 8 B 1.19%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 657ns 1.35ns 5.24ns 0.0095 0 0 672 B
master RunOnMethodBegin netcoreapp3.1 936ns 1.03ns 3.97ns 0.00908 0 0 672 B
master RunOnMethodBegin net472 1.15μs 1.27ns 4.73ns 0.101 0 0 634 B
#5385 RunOnMethodBegin net6.0 604ns 0.578ns 2.24ns 0.00956 0 0 680 B
#5385 RunOnMethodBegin netcoreapp3.1 961ns 1.6ns 6.21ns 0.00895 0 0 680 B
#5385 RunOnMethodBegin net472 1.09μs 1.56ns 6.06ns 0.102 0 0 642 B

@andrewlock
Copy link
Member

andrewlock commented Apr 3, 2024

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 (5385) (11.051M)   : 0, 11051013
    master (11.580M)   : 0, 11579584
    benchmarks/2.9.0 (11.259M)   : 0, 11258931

    section Automatic
    This PR (5385) (7.519M)   : crit ,0, 7518555
    master (8.053M)   : 0, 8052940
    benchmarks/2.9.0 (8.404M)   : 0, 8403894

    section Trace stats
    This PR (5385) (7.922M)   : 0, 7922329
    master (8.281M)   : 0, 8280646

    section Manual
    This PR (5385) (9.657M)   : 0, 9657497
    master (10.073M)   : 0, 10073320

    section Manual + Automatic
    This PR (5385) (7.376M)   : 0, 7376241
    master (7.066M)   : 0, 7065813

    section Version Conflict
    This PR (5385) (6.694M)   : 0, 6693939
    master (6.488M)   : 0, 6488455

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (5385) (9.682M)   : 0, 9681924
    master (9.428M)   : 0, 9428057
    benchmarks/2.9.0 (9.538M)   : 0, 9538176

    section Automatic
    This PR (5385) (6.682M)   : 0, 6681782
    master (6.445M)   : 0, 6444563

    section Trace stats
    This PR (5385) (6.976M)   : 0, 6975883
    master (6.986M)   : 0, 6986055

    section Manual
    This PR (5385) (8.287M)   : 0, 8287494
    master (8.182M)   : 0, 8181701

    section Manual + Automatic
    This PR (5385) (6.323M)   : 0, 6323340
    master (6.256M)   : 0, 6255649

    section Version Conflict
    This PR (5385) (5.720M)   : 0, 5720045
    master (5.723M)   : 0, 5723088

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (5385) (9.761M)   : 0, 9760955
    master (10.101M)   : 0, 10101260

    section Automatic
    This PR (5385) (6.995M)   : 0, 6995079
    master (7.201M)   : 0, 7200920

    section Trace stats
    This PR (5385) (7.307M)   : 0, 7306735
    master (7.429M)   : 0, 7429392

    section Manual
    This PR (5385) (8.574M)   : 0, 8574246
    master (9.018M)   : 0, 9018109

    section Manual + Automatic
    This PR (5385) (6.711M)   : 0, 6710559
    master (6.964M)   : 0, 6964112

    section Version Conflict
    This PR (5385) (6.087M)   : 0, 6086874
    master (6.292M)   : 0, 6291658

Loading

@lucaspimentel
Copy link
Member

lucaspimentel commented Apr 3, 2024

Alternatively, I think it is intentional that creating a SpanContext without a parent SpanContext is intended to be a "remote" context...

Not all SpanContext instances without a parent are remote. If we start a new trace that doesn't follow from a distributed trace (i.e. a new local trace, rootSpan.ParentId is null or 0), then rootSpan.SpanContext will not have a parent, and yet it is not remote.

I think you did the right thing by using the extractors to flag remote contexts.

@lucaspimentel lucaspimentel requested a review from a team April 3, 2024 21:55
@lucaspimentel lucaspimentel requested a review from a team April 3, 2024 22:03
@lucaspimentel lucaspimentel added the area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) label Apr 3, 2024
@lucaspimentel lucaspimentel changed the title Add IsRemote to SpanContext Add IsRemote to SpanContext Apr 3, 2024
@lucaspimentel lucaspimentel changed the title Add IsRemote to SpanContext [Tracing] Add IsRemote to SpanContext Apr 3, 2024
Copy link
Member

@lucaspimentel lucaspimentel left a comment

Choose a reason for hiding this comment

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

LGTM

@lucaspimentel lucaspimentel requested a review from a team April 4, 2024 16:26
This will help in the future when we want an easy
way to check if a SpanContext originated from
some distributed context compared to being
originated from a local context.
Copy link
Member

@andrewlock andrewlock left a comment

Choose a reason for hiding this comment

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

LGTM 👍

tracer/src/Datadog.Trace/SpanContext.cs Show resolved Hide resolved
Co-authored-by: Lucas Pimentel <lucas.pimentel@datadoghq.com>
@bouwkast bouwkast merged commit e35b85c into master Apr 9, 2024
56 of 57 checks passed
@bouwkast bouwkast deleted the steven/is-remote branch April 9, 2024 11:35
@github-actions github-actions bot added this to the vNext-v2 milestone Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants