dd-trace-dotnet icon indicating copy to clipboard operation
dd-trace-dotnet copied to clipboard

[Dynamic Instrumentation] DEBUG-2602 Collection expressions fixes

Open dudikeleti opened this issue 1 year ago • 4 comments

Summary of changes

This PR fixes som eissues with evaluating expresisons on different types of collections

Reason for change

To support more collection templates and conditions expressions in our expression language

dudikeleti avatar Sep 26 '24 12:09 dudikeleti

Datadog Report

Branch report: dudik/collections-expression-fixes Commit report: d20b8b7 Test service: dd-trace-dotnet

:white_check_mark: 0 Failed, 373707 Passed, 2714 Skipped, 25h 26m 8.04s Total Time :hourglass: 1 Performance Regression

:hourglass: Performance Regressions vs Default Branch (1)

  • Baseline_allocation - scenarios 1.58s (+56.49ms, +4%) - Details

datadog-ddstaging[bot] avatar Sep 26 '24 12:09 datadog-ddstaging[bot]

Execution-Time Benchmarks Report :stopwatch:

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 (6087) - mean (73ms)  : 70, 75
     .   : milestone, 73,
    master - mean (70ms)  : 68, 71
     .   : milestone, 70,

    section CallTarget+Inlining+NGEN
    This PR (6087) - mean (1,158ms)  : 1081, 1235
     .   : milestone, 1158,
    master - mean (1,110ms)  : 1092, 1128
     .   : milestone, 1110,

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

    section CallTarget+Inlining+NGEN
    This PR (6087) - mean (790ms)  : 776, 804
     .   : milestone, 790,
    master - mean (774ms)  : 762, 786
     .   : milestone, 774,

gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6087) - mean (94ms)  : 91, 98
     .   : milestone, 94,
    master - mean (92ms)  : 90, 94
     .   : milestone, 92,

    section CallTarget+Inlining+NGEN
    This PR (6087) - mean (749ms)  : 727, 771
     .   : milestone, 749,
    master - mean (730ms)  : 711, 750
     .   : milestone, 730,

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

    section CallTarget+Inlining+NGEN
    This PR (6087) - mean (1,223ms)  : 1193, 1252
     .   : milestone, 1223,
    master - mean (1,225ms)  : 1200, 1250
     .   : milestone, 1225,

gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6087) - mean (276ms)  : 271, 280
     .   : milestone, 276,
    master - mean (277ms)  : 273, 281
     .   : milestone, 277,

    section CallTarget+Inlining+NGEN
    This PR (6087) - mean (951ms)  : 934, 968
     .   : milestone, 951,
    master - mean (954ms)  : 937, 972
     .   : milestone, 954,

gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6087) - mean (264ms)  : 260, 268
     .   : milestone, 264,
    master - mean (265ms)  : 261, 270
     .   : milestone, 265,

    section CallTarget+Inlining+NGEN
    This PR (6087) - mean (941ms)  : 918, 964
     .   : milestone, 941,
    master - mean (936ms)  : 919, 953
     .   : milestone, 936,

andrewlock avatar Sep 26 '24 12:09 andrewlock

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 (6087) (11.261M)   : 0, 11260684
    master (11.139M)   : 0, 11138688
    benchmarks/2.9.0 (11.033M)   : 0, 11032866

    section Automatic
    This PR (6087) (7.268M)   : 0, 7267856
    master (7.219M)   : 0, 7218590
    benchmarks/2.9.0 (7.786M)   : 0, 7785853

    section Trace stats
    master (7.486M)   : 0, 7485598

    section Manual
    master (11.133M)   : 0, 11132545

    section Manual + Automatic
    This PR (6087) (6.691M)   : 0, 6691373
    master (6.587M)   : 0, 6587113

    section DD_TRACE_ENABLED=0
    master (10.300M)   : 0, 10299746

gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6087) (9.507M)   : 0, 9507335
    master (9.588M)   : 0, 9588198
    benchmarks/2.9.0 (9.495M)   : 0, 9494821

    section Automatic
    This PR (6087) (6.293M)   : 0, 6292843
    master (6.099M)   : 0, 6099079

    section Trace stats
    master (6.847M)   : 0, 6847072

    section Manual
    master (9.512M)   : 0, 9512301

    section Manual + Automatic
    This PR (6087) (5.872M)   : 0, 5871623
    master (5.888M)   : 0, 5888474

    section DD_TRACE_ENABLED=0
    master (8.809M)   : 0, 8808810

gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6087) (10.160M)   : 0, 10159631
    master (9.411M)   : 0, 9411423
    benchmarks/2.9.0 (10.020M)   : 0, 10019592

    section Automatic
    This PR (6087) (6.355M)   : 0, 6354692
    master (6.116M)   : 0, 6116060
    benchmarks/2.9.0 (7.255M)   : 0, 7255257

    section Trace stats
    master (6.865M)   : 0, 6865219

    section Manual
    master (9.608M)   : 0, 9607713

    section Manual + Automatic
    This PR (6087) (5.712M)   : 0, 5711898
    master (5.657M)   : 0, 5657383

    section DD_TRACE_ENABLED=0
    master (8.875M)   : 0, 8875378

andrewlock avatar Sep 26 '24 13:09 andrewlock

Benchmarks Report for tracer :snail:

Benchmarks for #6087 compared to master:

  • 1 benchmarks are faster, with geometric mean 1.185
  • 3 benchmarks are slower, with geometric mean 1.139
  • All benchmarks have the same 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 :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 7.66μs 41ns 232ns 0.0204 0.00816 0 5.43 KB
master StartStopWithChild netcoreapp3.1 10.1μs 55.3ns 336ns 0.0146 0.00486 0 5.62 KB
master StartStopWithChild net472 16.3μs 71.4ns 277ns 1.02 0.302 0.0953 6.07 KB
#6087 StartStopWithChild net6.0 7.66μs 40.7ns 215ns 0.018 0.00722 0 5.42 KB
#6087 StartStopWithChild netcoreapp3.1 9.88μs 53.4ns 282ns 0.0197 0.00492 0 5.62 KB
#6087 StartStopWithChild net472 16.2μs 77.7ns 301ns 1.02 0.309 0.0812 6.07 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 459μs 467ns 1.75μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 632μs 410ns 1.59μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 816μs 590ns 2.28μs 0.408 0 0 3.3 KB
#6087 WriteAndFlushEnrichedTraces net6.0 484μs 183ns 661ns 0 0 0 2.7 KB
#6087 WriteAndFlushEnrichedTraces netcoreapp3.1 641μs 207ns 775ns 0 0 0 2.7 KB
#6087 WriteAndFlushEnrichedTraces net472 839μs 348ns 1.3μs 0.419 0 0 3.3 KB
Benchmarks.Trace.AspNetCoreBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 195μs 1.07μs 7.85μs 0.188 0 0 18.45 KB
master SendRequest netcoreapp3.1 219μs 1.26μs 9.24μs 0.204 0 0 20.61 KB
master SendRequest net472 0.00322ns 0.00106ns 0.00409ns 0 0 0 0 b
#6087 SendRequest net6.0 195μs 1.09μs 7.26μs 0.193 0 0 18.45 KB
#6087 SendRequest netcoreapp3.1 221μs 1.25μs 9.38μs 0.217 0 0 20.61 KB
#6087 SendRequest net472 0.000376ns 0.000263ns 0.00102ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 567μs 2.59μs 9.7μs 0.561 0 0 41.58 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 694μs 3.74μs 19.8μs 0.331 0 0 41.7 KB
master WriteAndFlushEnrichedTraces net472 860μs 3.08μs 11.5μs 8.5 2.55 0.425 53.31 KB
#6087 WriteAndFlushEnrichedTraces net6.0 551μs 2.83μs 12.7μs 0.571 0 0 41.61 KB
#6087 WriteAndFlushEnrichedTraces netcoreapp3.1 674μs 3.2μs 12.4μs 0.332 0 0 41.56 KB
#6087 WriteAndFlushEnrichedTraces net472 856μs 2.27μs 8.79μs 8.33 2.5 0.417 53.3 KB
Benchmarks.Trace.DbCommandBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 1.25μs 1.32ns 5.13ns 0.0145 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.74μs 0.908ns 3.4ns 0.0132 0 0 1.02 KB
master ExecuteNonQuery net472 2.1μs 1.63ns 6.3ns 0.156 0 0 987 B
#6087 ExecuteNonQuery net6.0 1.31μs 1.23ns 4.76ns 0.0139 0 0 1.02 KB
#6087 ExecuteNonQuery netcoreapp3.1 1.77μs 1.28ns 4.78ns 0.0134 0 0 1.02 KB
#6087 ExecuteNonQuery net472 2.12μs 1.52ns 5.7ns 0.157 0 0 987 B
Benchmarks.Trace.ElasticsearchBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.19μs 2.72ns 10.5ns 0.0138 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.51μs 0.484ns 1.81ns 0.0128 0 0 976 B
master CallElasticsearch net472 2.55μs 2.83ns 11ns 0.158 0 0 995 B
master CallElasticsearchAsync net6.0 1.2μs 0.846ns 3.28ns 0.0131 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.7μs 0.992ns 3.71ns 0.0135 0 0 1.02 KB
master CallElasticsearchAsync net472 2.62μs 2.56ns 9.9ns 0.166 0 0 1.05 KB
#6087 CallElasticsearch net6.0 1.11μs 0.842ns 3.26ns 0.0134 0 0 976 B
#6087 CallElasticsearch netcoreapp3.1 1.51μs 7.03ns 27.2ns 0.0128 0 0 976 B
#6087 CallElasticsearch net472 2.63μs 2.72ns 10.5ns 0.157 0 0 995 B
#6087 CallElasticsearchAsync net6.0 1.3μs 1.09ns 4.09ns 0.013 0 0 952 B
#6087 CallElasticsearchAsync netcoreapp3.1 1.64μs 1.14ns 4.41ns 0.0139 0 0 1.02 KB
#6087 CallElasticsearchAsync net472 2.48μs 2.09ns 8.1ns 0.166 0 0 1.05 KB
Benchmarks.Trace.GraphQLBenchmark - Faster :tada: Same allocations :heavy_check_mark:

Faster :tada: in #6087

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net6.0 1.185 1,384.54 1,168.06

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net6.0 1.38μs 0.977ns 3.65ns 0.0131 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.62μs 0.528ns 1.9ns 0.013 0 0 952 B
master ExecuteAsync net472 1.76μs 0.534ns 2.07ns 0.145 0 0 915 B
#6087 ExecuteAsync net6.0 1.17μs 0.688ns 2.66ns 0.0136 0 0 952 B
#6087 ExecuteAsync netcoreapp3.1 1.55μs 3.19ns 12.4ns 0.0132 0 0 952 B
#6087 ExecuteAsync net472 1.72μs 0.501ns 1.81ns 0.145 0 0 915 B
Benchmarks.Trace.HttpClientBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendAsync net6.0 4.23μs 10.6ns 41.1ns 0.0317 0 0 2.22 KB
master SendAsync netcoreapp3.1 4.96μs 1.93ns 7.24ns 0.0372 0 0 2.76 KB
master SendAsync net472 7.66μs 2.95ns 11.4ns 0.499 0 0 3.15 KB
#6087 SendAsync net6.0 4.13μs 0.939ns 3.64ns 0.031 0 0 2.22 KB
#6087 SendAsync netcoreapp3.1 5.13μs 2.29ns 8.87ns 0.0363 0 0 2.76 KB
#6087 SendAsync net472 7.75μs 1.3ns 5.04ns 0.496 0 0 3.15 KB
Benchmarks.Trace.ILoggerBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 1.53μs 0.952ns 3.69ns 0.0229 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.33μs 2.57ns 9.63ns 0.022 0 0 1.64 KB
master EnrichedLog net472 2.61μs 1.14ns 4.26ns 0.25 0 0 1.57 KB
#6087 EnrichedLog net6.0 1.48μs 1.23ns 4.59ns 0.0229 0 0 1.64 KB
#6087 EnrichedLog netcoreapp3.1 2.28μs 1.03ns 3.85ns 0.0218 0 0 1.64 KB
#6087 EnrichedLog net472 2.61μs 1.11ns 4.3ns 0.249 0 0 1.57 KB
Benchmarks.Trace.Log4netBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 114μs 147ns 550ns 0.0571 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 118μs 240ns 928ns 0.0597 0 0 4.28 KB
master EnrichedLog net472 147μs 156ns 603ns 0.662 0.221 0 4.46 KB
#6087 EnrichedLog net6.0 115μs 115ns 447ns 0.0571 0 0 4.28 KB
#6087 EnrichedLog netcoreapp3.1 119μs 133ns 517ns 0 0 0 4.28 KB
#6087 EnrichedLog net472 147μs 87ns 337ns 0.661 0.22 0 4.46 KB
Benchmarks.Trace.NLogBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 3.22μs 1.67ns 6.46ns 0.0306 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.12μs 5.94ns 23ns 0.0286 0 0 2.2 KB
master EnrichedLog net472 4.75μs 2.03ns 7.86ns 0.32 0 0 2.02 KB
#6087 EnrichedLog net6.0 3.1μs 0.736ns 2.85ns 0.031 0 0 2.2 KB
#6087 EnrichedLog netcoreapp3.1 4.07μs 1.63ns 6.11ns 0.0307 0 0 2.2 KB
#6087 EnrichedLog net472 4.82μs 0.78ns 3.02ns 0.319 0 0 2.02 KB
Benchmarks.Trace.RedisBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net6.0 1.27μs 0.633ns 2.37ns 0.0159 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.76μs 0.651ns 2.52ns 0.015 0 0 1.14 KB
master SendReceive net472 2.07μs 0.948ns 3.55ns 0.183 0 0 1.16 KB
#6087 SendReceive net6.0 1.27μs 0.64ns 2.48ns 0.016 0 0 1.14 KB
#6087 SendReceive netcoreapp3.1 1.8μs 1.16ns 4.49ns 0.0153 0 0 1.14 KB
#6087 SendReceive net472 2.14μs 1.15ns 4.45ns 0.183 0 0 1.16 KB
Benchmarks.Trace.SerilogBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 2.81μs 0.942ns 3.65ns 0.0224 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.88μs 2.39ns 9.27ns 0.0215 0 0 1.65 KB
master EnrichedLog net472 4.31μs 2.81ns 10.9ns 0.323 0 0 2.04 KB
#6087 EnrichedLog net6.0 2.76μs 0.815ns 3.16ns 0.0221 0 0 1.6 KB
#6087 EnrichedLog netcoreapp3.1 3.97μs 2.96ns 11.5ns 0.0217 0 0 1.65 KB
#6087 EnrichedLog net472 4.44μs 7.75ns 30ns 0.324 0 0 2.04 KB
Benchmarks.Trace.SpanBenchmark - Slower :warning: Same allocations :heavy_check_mark:

Slower :warning: in #6087

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 1.183 399.34 472.44
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 1.113 542.02 603.41

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 399ns 0.421ns 1.63ns 0.00818 0 0 576 B
master StartFinishSpan netcoreapp3.1 541ns 0.532ns 2.06ns 0.00794 0 0 576 B
master StartFinishSpan net472 735ns 0.366ns 1.42ns 0.0916 0 0 578 B
master StartFinishScope net6.0 471ns 0.411ns 1.59ns 0.00971 0 0 696 B
master StartFinishScope netcoreapp3.1 729ns 0.285ns 1.1ns 0.00918 0 0 696 B
master StartFinishScope net472 894ns 1.61ns 6.23ns 0.104 0 0 658 B
#6087 StartFinishSpan net6.0 472ns 0.208ns 0.778ns 0.00808 0 0 576 B
#6087 StartFinishSpan netcoreapp3.1 604ns 0.329ns 1.27ns 0.00768 0 0 576 B
#6087 StartFinishSpan net472 665ns 0.349ns 1.35ns 0.0916 0 0 578 B
#6087 StartFinishScope net6.0 480ns 0.225ns 0.844ns 0.00988 0 0 696 B
#6087 StartFinishScope netcoreapp3.1 707ns 0.391ns 1.52ns 0.00923 0 0 696 B
#6087 StartFinishScope net472 896ns 0.45ns 1.74ns 0.104 0 0 658 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Slower :warning: Same allocations :heavy_check_mark:

Slower :warning: in #6087

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 1.122 605.92 680.04

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 606ns 0.269ns 1.01ns 0.00975 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 848ns 0.522ns 1.81ns 0.00937 0 0 696 B
master RunOnMethodBegin net472 1.02μs 0.635ns 2.46ns 0.104 0 0 658 B
#6087 RunOnMethodBegin net6.0 680ns 0.274ns 1.02ns 0.00996 0 0 696 B
#6087 RunOnMethodBegin netcoreapp3.1 902ns 1.54ns 5.96ns 0.00927 0 0 696 B
#6087 RunOnMethodBegin net472 1.1μs 0.31ns 1.2ns 0.104 0 0 658 B

andrewlock avatar Sep 26 '24 19:09 andrewlock