Skip to content

wip: add support for Batch in AdoNet #5436

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

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft

wip: add support for Batch in AdoNet #5436

wants to merge 11 commits into from

Conversation

vandonr
Copy link
Contributor

@vandonr vandonr commented Apr 12, 2024

Summary of changes

adding support for batch commands, following otel spec, i.e. the resource is the concatenation of all the commands in the batch.

Reason for change

https://datadoghq.atlassian.net/browse/FRAPMS-4414

Implementation details

I had to shuffle existing methods a bit, because even though IDbCommand and DbBatch share some common properties, there is no common interface.

Test coverage

I added a batch command to NpgSql test, but the same should be done for other SQL frameworks accepting batches, and we should probably test the different ways to call it like we do for other commands.

@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Apr 12, 2024

Datadog Report

Branch report: vandonr/db
Commit report: 06b81e9
Test service: dd-trace-dotnet

✅ 0 Failed, 339146 Passed, 1520 Skipped, 43m 46.83s Wall Time

@andrewlock
Copy link
Member

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 (5436) - mean (71ms)  : 68, 73
     .   : milestone, 71,
    master - mean (73ms)  : 64, 81
     .   : milestone, 73,

    section CallTarget+Inlining+NGEN
    This PR (5436) - mean (1,015ms)  : 991, 1039
     .   : milestone, 1015,
    master - mean (1,015ms)  : 994, 1035
     .   : milestone, 1015,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5436) - mean (110ms)  : 107, 113
     .   : milestone, 110,
    master - mean (110ms)  : 106, 114
     .   : milestone, 110,

    section CallTarget+Inlining+NGEN
    This PR (5436) - mean (734ms)  : 709, 759
     .   : milestone, 734,
    master - mean (733ms)  : 712, 754
     .   : milestone, 733,

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

    section CallTarget+Inlining+NGEN
    This PR (5436) - mean (687ms)  : 669, 705
     .   : milestone, 687,
    master - mean (689ms)  : 667, 712
     .   : milestone, 689,

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

    section CallTarget+Inlining+NGEN
    This PR (5436) - mean (1,081ms)  : 1061, 1100
     .   : milestone, 1081,
    master - mean (1,074ms)  : 1049, 1099
     .   : milestone, 1074,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5436) - mean (271ms)  : 267, 275
     .   : milestone, 271,
    master - mean (270ms)  : 265, 276
     .   : milestone, 270,

    section CallTarget+Inlining+NGEN
    This PR (5436) - mean (879ms)  : 850, 908
     .   : milestone, 879,
    master - mean (869ms)  : 843, 894
     .   : milestone, 869,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5436) - mean (260ms)  : 255, 264
     .   : milestone, 260,
    master - mean (260ms)  : 256, 265
     .   : milestone, 260,

    section CallTarget+Inlining+NGEN
    This PR (5436) - mean (858ms)  : 835, 881
     .   : milestone, 858,
    master - mean (848ms)  : 826, 869
     .   : milestone, 848,

Loading

@andrewlock
Copy link
Member

Benchmarks Report for tracer 🐌

Benchmarks for #5436 compared to master:

  • 3 benchmarks are faster, with geometric mean 1.177
  • 1 benchmarks are slower, with geometric mean 1.124
  • 1 benchmarks have fewer allocations
  • 1 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.58μs 43.6ns 258ns 0.018 0.00902 0 7.54 KB
master StartStopWithChild netcoreapp3.1 10.8μs 53.6ns 221ns 0.0286 0.0114 0 7.64 KB
master StartStopWithChild net472 17μs 41ns 159ns 1.36 0.382 0.127 8.08 KB
#5436 StartStopWithChild net6.0 8.61μs 44.2ns 216ns 0.022 0.0088 0 7.54 KB
#5436 StartStopWithChild netcoreapp3.1 10.8μs 58.2ns 329ns 0.0367 0.0157 0 7.63 KB
#5436 StartStopWithChild net472 17μs 55ns 213ns 1.35 0.351 0.12 8.08 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 479μs 816ns 3.16μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 620μs 188ns 727ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 818μs 465ns 1.8μs 0.408 0 0 3.3 KB
#5436 WriteAndFlushEnrichedTraces net6.0 460μs 171ns 662ns 0 0 0 2.7 KB
#5436 WriteAndFlushEnrichedTraces netcoreapp3.1 628μs 225ns 811ns 0 0 0 2.7 KB
#5436 WriteAndFlushEnrichedTraces net472 813μs 318ns 1.15μs 0.408 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 170μs 289ns 1.12μs 0.254 0 0 18.38 KB
master SendRequest netcoreapp3.1 188μs 350ns 1.35μs 0.185 0 0 20.54 KB
master SendRequest net472 0ns 0ns 0ns 0 0 0 0 b
#5436 SendRequest net6.0 170μs 299ns 1.16μs 0.254 0 0 18.38 KB
#5436 SendRequest netcoreapp3.1 191μs 326ns 1.26μs 0.193 0 0 20.54 KB
#5436 SendRequest net472 0.000715ns 0.000245ns 0.000918ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #5436

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 41.54 KB 41.78 KB 241 B 0.58%

Fewer allocations 🎉 in #5436

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 41.8 KB 41.59 KB -214 B -0.51%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 547μs 1.67μs 6.47μs 0.558 0 0 41.54 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 663μs 1.34μs 5.17μs 0.329 0 0 41.8 KB
master WriteAndFlushEnrichedTraces net472 844μs 3.72μs 16.2μs 8.13 2.57 0.428 53.24 KB
#5436 WriteAndFlushEnrichedTraces net6.0 547μs 242ns 874ns 0.551 0 0 41.78 KB
#5436 WriteAndFlushEnrichedTraces netcoreapp3.1 652μs 1.19μs 4.61μs 0.322 0 0 41.59 KB
#5436 WriteAndFlushEnrichedTraces net472 850μs 2.94μs 11.4μs 8.08 2.55 0.425 53.24 KB
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 1.14μs 0.304ns 1.14ns 0.0114 0 0 800 B
master ExecuteNonQuery netcoreapp3.1 1.57μs 3.54ns 13.2ns 0.0102 0 0 800 B
master ExecuteNonQuery net472 1.81μs 0.797ns 2.98ns 0.121 0 0 762 B
#5436 ExecuteNonQuery net6.0 1.23μs 0.58ns 2.25ns 0.0111 0 0 800 B
#5436 ExecuteNonQuery netcoreapp3.1 1.55μs 0.943ns 3.65ns 0.0109 0 0 800 B
#5436 ExecuteNonQuery net472 1.87μs 0.662ns 2.29ns 0.121 0 0 762 B
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.33μs 2.98ns 11.6ns 0.0143 0 0 1.02 KB
master CallElasticsearch netcoreapp3.1 1.63μs 0.68ns 2.54ns 0.0138 0 0 1.02 KB
master CallElasticsearch net472 2.58μs 1.95ns 7.54ns 0.164 0 0 1.04 KB
master CallElasticsearchAsync net6.0 1.37μs 3.74ns 14.5ns 0.014 0 0 1 KB
master CallElasticsearchAsync netcoreapp3.1 1.67μs 1.3ns 4.87ns 0.0145 0 0 1.07 KB
master CallElasticsearchAsync net472 2.65μs 5.73ns 20.6ns 0.172 0 0 1.09 KB
#5436 CallElasticsearch net6.0 1.36μs 1.07ns 4.01ns 0.0144 0 0 1.02 KB
#5436 CallElasticsearch netcoreapp3.1 1.62μs 4.76ns 18.4ns 0.0137 0 0 1.02 KB
#5436 CallElasticsearch net472 2.58μs 2.01ns 7.52ns 0.164 0 0 1.04 KB
#5436 CallElasticsearchAsync net6.0 1.36μs 0.512ns 1.98ns 0.0143 0 0 1 KB
#5436 CallElasticsearchAsync netcoreapp3.1 1.76μs 1.32ns 4.94ns 0.0142 0 0 1.07 KB
#5436 CallElasticsearchAsync net472 2.62μs 1.88ns 7.03ns 0.173 0 0 1.09 KB
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net6.0 1.32μs 0.616ns 2.3ns 0.0132 0 0 944 B
master ExecuteAsync netcoreapp3.1 1.69μs 0.59ns 2.13ns 0.0127 0 0 944 B
master ExecuteAsync net472 1.69μs 0.847ns 3.28ns 0.144 0 0 907 B
#5436 ExecuteAsync net6.0 1.33μs 0.563ns 2.18ns 0.0134 0 0 944 B
#5436 ExecuteAsync netcoreapp3.1 1.77μs 1.87ns 7.25ns 0.013 0 0 944 B
#5436 ExecuteAsync net472 1.83μs 2.66ns 10.3ns 0.144 0 0 907 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.2μs 2.67ns 9.99ns 0.0297 0 0 2.18 KB
master SendAsync netcoreapp3.1 5.02μs 2.04ns 7.64ns 0.0377 0 0 2.71 KB
master SendAsync net472 7.7μs 2.15ns 8.34ns 0.485 0 0 3.07 KB
#5436 SendAsync net6.0 4.13μs 2.49ns 9.31ns 0.0308 0 0 2.18 KB
#5436 SendAsync netcoreapp3.1 5.08μs 3.38ns 13.1ns 0.0355 0 0 2.71 KB
#5436 SendAsync net472 7.74μs 2.97ns 11.1ns 0.485 0 0 3.07 KB
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 1.55μs 1.23ns 4.59ns 0.024 0 0 1.68 KB
master EnrichedLog netcoreapp3.1 2.12μs 1.38ns 4.97ns 0.0226 0 0 1.68 KB
master EnrichedLog net472 2.62μs 1.76ns 6.08ns 0.254 0 0 1.61 KB
#5436 EnrichedLog net6.0 1.44μs 0.84ns 3.14ns 0.0237 0 0 1.68 KB
#5436 EnrichedLog netcoreapp3.1 2.27μs 1.45ns 5.23ns 0.0228 0 0 1.68 KB
#5436 EnrichedLog net472 2.72μs 1.87ns 7.26ns 0.255 0 0 1.61 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 113μs 305ns 1.18μs 0.0562 0 0 4.26 KB
master EnrichedLog netcoreapp3.1 119μs 162ns 629ns 0.0598 0 0 4.26 KB
master EnrichedLog net472 149μs 186ns 696ns 0.663 0.221 0 4.45 KB
#5436 EnrichedLog net6.0 111μs 71ns 266ns 0.0558 0 0 4.26 KB
#5436 EnrichedLog netcoreapp3.1 121μs 131ns 509ns 0.0602 0 0 4.26 KB
#5436 EnrichedLog net472 149μs 144ns 558ns 0.67 0.223 0 4.45 KB
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 3.15μs 0.965ns 3.61ns 0.0319 0 0 2.24 KB
master EnrichedLog netcoreapp3.1 4.29μs 4.84ns 18.8ns 0.0301 0 0 2.24 KB
master EnrichedLog net472 4.92μs 1.8ns 6.97ns 0.325 0 0 2.05 KB
#5436 EnrichedLog net6.0 3.14μs 1.38ns 5.18ns 0.0315 0 0 2.24 KB
#5436 EnrichedLog netcoreapp3.1 4.16μs 2.24ns 8.69ns 0.0291 0 0 2.24 KB
#5436 EnrichedLog net472 4.82μs 1.11ns 3.98ns 0.326 0 0 2.05 KB
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net6.0 1.47μs 0.616ns 2.31ns 0.0162 0 0 1.19 KB
master SendReceive netcoreapp3.1 1.79μs 0.754ns 2.92ns 0.0162 0 0 1.19 KB
master SendReceive net472 2.25μs 6.82ns 26.4ns 0.19 0 0 1.2 KB
#5436 SendReceive net6.0 1.47μs 1.09ns 4.24ns 0.0168 0 0 1.19 KB
#5436 SendReceive netcoreapp3.1 1.87μs 2.23ns 8.05ns 0.016 0 0 1.19 KB
#5436 SendReceive net472 2.24μs 1.59ns 5.53ns 0.19 0.00112 0 1.2 KB
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 2.72μs 0.905ns 3.39ns 0.022 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 4.01μs 1.43ns 5.55ns 0.0222 0 0 1.63 KB
master EnrichedLog net472 4.51μs 2.51ns 9.72ns 0.319 0 0 2.02 KB
#5436 EnrichedLog net6.0 2.75μs 1.36ns 4.89ns 0.022 0 0 1.58 KB
#5436 EnrichedLog netcoreapp3.1 4.1μs 1.51ns 5.86ns 0.0225 0 0 1.63 KB
#5436 EnrichedLog net472 4.48μs 3.9ns 15.1ns 0.319 0 0 2.02 KB
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #5436

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑netcoreapp3.1 1.124 811.87 912.35

Faster 🎉 in #5436

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 1.255 674.53 537.53
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 1.162 815.77 702.29
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net472 1.119 860.71 769.14

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 516ns 0.632ns 2.45ns 0.00791 0 0 568 B
master StartFinishSpan netcoreapp3.1 815ns 1.01ns 3.92ns 0.00742 0 0 568 B
master StartFinishSpan net472 861ns 1.62ns 6.27ns 0.0903 0 0 570 B
master StartFinishScope net6.0 674ns 1.45ns 5.62ns 0.00942 0 0 688 B
master StartFinishScope netcoreapp3.1 812ns 1.31ns 5.06ns 0.00922 0 0 688 B
master StartFinishScope net472 1.02μs 1.7ns 6.59ns 0.103 0 0 650 B
#5436 StartFinishSpan net6.0 567ns 0.857ns 3.32ns 0.00804 0 0 568 B
#5436 StartFinishSpan netcoreapp3.1 701ns 1.39ns 5.19ns 0.00743 0 0 568 B
#5436 StartFinishSpan net472 769ns 1.77ns 6.86ns 0.0903 0 0 570 B
#5436 StartFinishScope net6.0 537ns 0.748ns 2.7ns 0.00976 0 0 688 B
#5436 StartFinishScope netcoreapp3.1 911ns 1.63ns 6.3ns 0.00948 0 0 688 B
#5436 StartFinishScope net472 1.01μs 1.8ns 6.97ns 0.103 0 0 650 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 624ns 1.32ns 5.1ns 0.00963 0 0 688 B
master RunOnMethodBegin netcoreapp3.1 985ns 2.21ns 8.55ns 0.00936 0 0 688 B
master RunOnMethodBegin net472 1.09μs 1.72ns 6.64ns 0.103 0 0 650 B
#5436 RunOnMethodBegin net6.0 591ns 1.02ns 3.95ns 0.0096 0 0 688 B
#5436 RunOnMethodBegin netcoreapp3.1 960ns 1.13ns 4.37ns 0.00906 0 0 688 B
#5436 RunOnMethodBegin net472 1.07μs 1.64ns 6.13ns 0.103 0 0 650 B

@andrewlock
Copy link
Member

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 (5436) (11.243M)   : 0, 11243079
    master (11.579M)   : 0, 11579082
    benchmarks/2.9.0 (11.318M)   : 0, 11318115

    section Automatic
    This PR (5436) (7.748M)   : 0, 7747686
    master (7.868M)   : 0, 7867538
    benchmarks/2.9.0 (8.243M)   : 0, 8242592

    section Trace stats
    This PR (5436) (8.084M)   : 0, 8084187
    master (8.207M)   : 0, 8206614

    section Manual
    This PR (5436) (9.863M)   : 0, 9863425
    master (9.989M)   : 0, 9988646

    section Manual + Automatic
    This PR (5436) (7.369M)   : 0, 7368822
    master (7.476M)   : 0, 7475675

    section Version Conflict
    This PR (5436) (6.619M)   : 0, 6619385
    master (6.640M)   : 0, 6640100

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (5436) (9.547M)   : 0, 9547125
    master (9.560M)   : 0, 9560449
    benchmarks/2.9.0 (9.501M)   : 0, 9500806

    section Automatic
    This PR (5436) (6.517M)   : 0, 6516975
    master (6.528M)   : 0, 6527763

    section Trace stats
    This PR (5436) (6.948M)   : 0, 6947627
    master (6.951M)   : 0, 6951473

    section Manual
    This PR (5436) (8.298M)   : 0, 8297594
    master (8.226M)   : 0, 8225590

    section Manual + Automatic
    This PR (5436) (6.285M)   : 0, 6284713
    master (6.202M)   : 0, 6201979

    section Version Conflict
    This PR (5436) (5.578M)   : 0, 5577759
    master (5.725M)   : 0, 5724860

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (5436) (9.826M)   : 0, 9825636
    master (9.979M)   : 0, 9979373
    benchmarks/2.9.0 (10.118M)   : 0, 10118266

    section Automatic
    This PR (5436) (7.060M)   : 0, 7059503
    master (7.131M)   : 0, 7130680
    benchmarks/2.9.0 (7.188M)   : 0, 7188078

    section Trace stats
    This PR (5436) (7.434M)   : 0, 7434389
    master (7.356M)   : 0, 7356154

    section Manual
    This PR (5436) (8.679M)   : 0, 8678564
    master (8.785M)   : 0, 8784806

    section Manual + Automatic
    This PR (5436) (6.728M)   : 0, 6728079
    master (6.902M)   : 0, 6902142

    section Version Conflict
    This PR (5436) (6.103M)   : 0, 6102845
    master (6.246M)   : 0, 6245909

Loading

@m-gasser
Copy link

m-gasser commented Mar 3, 2025

Was this change deprioritized or is something blocking it? We use batches in quite some places now, so this would be useful for us.

@vandonr
Copy link
Contributor Author

vandonr commented Mar 3, 2025

Was this change deprioritized or is something blocking it? We use batches in quite some places now, so this would be useful for us.

A bit of both. It was not especially prioritized, and the main blocker was in deciding how the batches would be represented in spans.
I started this because a customer was using a framework that used batches even for single queries, but then we decided we needed to handle batches with several queries.
Maybe you can help us here in telling us what would be the most useful to you as a user of batches ? We were thinking of one of the following:

  • showing the first request only, with something like (3 more queries) to represent the rest of the batch
  • having one span per query in the request, maybe with a hard limit at 10 queries or so
  • trying to group the queries when the batch is like 100 times the same kind of insert
  • ... ?

What would you like to see in the trace when you send a batch request ?

@m-gasser
Copy link

m-gasser commented Mar 3, 2025

the main blocker was in deciding how the batches would be represented in spans.

Yeah, that is not that easy and we are not sure what is best either.

Maybe you can help us here in telling us what would be the most useful to you as a user of batches?

In our case, we have a custom ORM for which we create some spans. In the non batched case we create a span for each query, from this we can see the overall duration including the ORM overhead and the time it takes over the network. Nested inside is the ADO.NET span, where we see the time without the network transmission. I am actually not sure what is measured but I guess it is the time from sending the request until first byte of the response?
For queries in batches it would be nice to have the individual spans with timing information but I am not sure if you can get that data. Where the spans are placed (after each other or below each other) does not matter much for us.

trying to group the queries when the batch is like 100 times the same kind of insert

This will definitely be important for Inserts and Updates. For our custom ORM we use bulk inserts for inserting, so no issues there. On the other hand, for updates we send individual statements in a batch and creating a span for each would very likely be problematic. We are also using EF Core where this also would be important (or become important the more they are using batching). In case of SaveChanges there might be a batch consisting of queries, multiple groups of inserts and updates and at the end again some queries. It would be nice to see all the different queries but without the useless repetition.

having one span per query in the request, maybe with a hard limit at 10 queries or so

Limiting the number of sub-queries sounds like a good idea. If grouping is implemented the limit can probably be higher than 10 because it would just be a fail-safe if grouping fails for some reason. Without grouping 10 sounds fine, higher numbers will just lead to useless spam.

@vandonr
Copy link
Contributor Author

vandonr commented Mar 3, 2025

We can't have more granularity than the time it took for the whole batch to come back (i.e. we can't time individual queries in the batch). I now remember that this was an issue if we were to individualize the queries into their own spans, then they would all look like they're taking the whole timespan of the batch, and this would mess up the duration stats for those queries.

@m-gasser
Copy link

m-gasser commented Mar 3, 2025

I now remember that this was an issue if we were to individualize the queries into their own spans, then they would all look like they're taking the whole timespan of the batch, and this would mess up the duration stats for those queries.

This is unfortunate. But are duration stats not messed up anyways? Currently only the first query is shown and it looks like it is slower than it actually is. Dividing the total duration by the number of queries would not be worse compared to the status quo. Maybe there is a good way to make it clear in the UI, that the duration cannot be inferred from the length of the bar.

@Hawxy
Copy link

Hawxy commented Jun 16, 2025

@vandonr I'd thought I'd check in on this being I'm both the original requesting customer and also a maintainer of the framework that requires this (Marten) 😅. Npgsql got full OTEL support in v9 which includes batches, so to unblock this could we just duplicate that implementation of showing a single span with all of the batch queries appended together?https://github.com/npgsql/npgsql/blob/fe7f7755ed78b5292d38c890b110b76ca94e111f/src/Npgsql/NpgsqlCommand.cs#L1731
https://github.com/npgsql/npgsql/blob/fe7f7755ed78b5292d38c890b110b76ca94e111f/src/Npgsql/NpgsqlCommand.cs#L196

95% of Marten queries are likely to be a single query in a batch, so for the majority of usages there'd be no visual difference vs a standard command.

@vandonr
Copy link
Contributor Author

vandonr commented Jun 18, 2025

Npgsql got full OTEL support in v9 which includes batches

ah this is interesting, was this based on an official OTel spec for batch queries, or was it just done like this because ? 😛
We tend to follow what OTel spec says for spans when there is one indeed, so we can maybe move ahead like that :)

@Hawxy
Copy link

Hawxy commented Jun 18, 2025

ah this is interesting, was this based on an official OTel spec for batch queries, or was it just done like this because

It does appear to be in the spec:
https://opentelemetry.io/docs/specs/semconv/database/database-spans/
For batch operations, if the individual operations are known to have the same query text then that query text SHOULD be used, otherwise all of the individual query texts SHOULD be concatenated with separator ; or some other database system specific separator if more applicable.

vandonr added 4 commits June 18, 2025 14:43
# Conflicts:
#	tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AdoNet/AdoNetClientInstrumentMethodsAttribute.cs
#	tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AdoNet/DbScopeFactory.cs
#	tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Jun 19, 2025

Datadog Report

All test runs 8e095ab 🔗

2 Total Test Services: 1 Failed, 1 Passed

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Test Service View
dd-trace-dotnet 1741 0 0 307773 3581 32h 35m 23.32s Link
exploration_tests 0 0 0 22085 3 2m 23.42s Link

❌ Failed Tests (1741)

This report shows up to 5 failed tests.

  • SubmitsTraces - Datadog.Trace.ClrProfiler.IntegrationTests.AdoNet.MicrosoftDataSqlClientTests - Details

    Expand for error
     Assert.Equal() Failure
     Expected: 147
     Actual:   294
    
  • SubmitsTraces - Datadog.Trace.ClrProfiler.IntegrationTests.AdoNet.MicrosoftDataSqlClientTests - Details

    Expand for error
     Assert.Equal() Failure
     Expected: 147
     Actual:   294
    
  • SubmitsTraces - Datadog.Trace.ClrProfiler.IntegrationTests.AdoNet.MicrosoftDataSqlClientTests - Details

    Expand for error
     Assert.Equal() Failure
     Expected: 147
     Actual:   294
    
  • SubmitsTraces - Datadog.Trace.ClrProfiler.IntegrationTests.AdoNet.MicrosoftDataSqlClientTests - Details

    Expand for error
     Assert.Equal() Failure
     Expected: 147
     Actual:   294
    
  • SubmitsTraces - Datadog.Trace.ClrProfiler.IntegrationTests.AdoNet.MicrosoftDataSqlClientTests - Details

    Expand for error
     Assert.Equal() Failure
     Expected: 147
     Actual:   294
    

@pr-commenter
Copy link

pr-commenter bot commented Jun 19, 2025

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #5436 compared to master:

  • 1 benchmarks are slower, with geometric mean 1.218
  • 41 benchmarks have fewer allocations
  • 6 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 ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5436

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472 6.09 KB 6.04 KB -47 B -0.77%
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net6.0 5.58 KB 5.51 KB -70 B -1.26%
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑netcoreapp3.1 5.75 KB 5.68 KB -73 B -1.27%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 11.2μs 59.7ns 322ns 0 0 0 5.58 KB
master StartStopWithChild netcoreapp3.1 14.1μs 67.5ns 286ns 0 0 0 5.75 KB
master StartStopWithChild net472 22.1μs 119ns 651ns 1.03 0.411 0.103 6.09 KB
#5436 StartStopWithChild net6.0 10.3μs 57ns 374ns 0 0 0 5.51 KB
#5436 StartStopWithChild netcoreapp3.1 14μs 71.5ns 335ns 0 0 0 5.68 KB
#5436 StartStopWithChild net472 21.3μs 117ns 692ns 0.973 0.324 0.108 6.04 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5436

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 3.33 KB 3.31 KB -23 B -0.69%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 927μs 26.6ns 103ns 0 0 0 2.71 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.04ms 404ns 1.56μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.25ms 357ns 1.38μs 0 0 0 3.33 KB
#5436 WriteAndFlushEnrichedTraces net6.0 947μs 189ns 683ns 0 0 0 2.71 KB
#5436 WriteAndFlushEnrichedTraces netcoreapp3.1 1.02ms 55.8ns 216ns 0 0 0 2.7 KB
#5436 WriteAndFlushEnrichedTraces net472 1.2ms 78.1ns 302ns 0 0 0 3.31 KB
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #5436

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑net472 236.35 KB 239.64 KB 3.28 KB 1.39%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody‑net472 239.87 KB 243.15 KB 3.28 KB 1.37%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 331μs 1.76μs 8.42μs 0 0 0 197.06 KB
master AllCycleSimpleBody netcoreapp3.1 510μs 1.45μs 5.61μs 0 0 0 204.77 KB
master AllCycleSimpleBody net472 436μs 119ns 460ns 36.6 2.16 0 236.35 KB
master AllCycleMoreComplexBody net6.0 338μs 1.76μs 8.8μs 0 0 0 200.56 KB
master AllCycleMoreComplexBody netcoreapp3.1 495μs 987ns 3.56μs 0 0 0 208.18 KB
master AllCycleMoreComplexBody net472 446μs 106ns 412ns 36.6 2.16 0 239.87 KB
master ObjectExtractorSimpleBody net6.0 311ns 1.77ns 12.3ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 409ns 1.93ns 8.2ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 303ns 0.175ns 0.676ns 0.0442 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.52μs 29.5ns 110ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.76μs 36.2ns 140ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.66μs 0.89ns 3.33ns 0.599 0 0 3.8 KB
#5436 AllCycleSimpleBody net6.0 339μs 794ns 3.08μs 0 0 0 197.6 KB
#5436 AllCycleSimpleBody netcoreapp3.1 491μs 1.49μs 5.75μs 0 0 0 205.35 KB
#5436 AllCycleSimpleBody net472 443μs 134ns 485ns 36.6 2.16 0 239.64 KB
#5436 AllCycleMoreComplexBody net6.0 340μs 1.44μs 5.39μs 0 0 0 201.1 KB
#5436 AllCycleMoreComplexBody netcoreapp3.1 517μs 1.79μs 6.94μs 0 0 0 208.77 KB
#5436 AllCycleMoreComplexBody net472 457μs 319ns 1.24μs 37.9 2.23 0 243.15 KB
#5436 ObjectExtractorSimpleBody net6.0 315ns 1.59ns 7.45ns 0 0 0 280 B
#5436 ObjectExtractorSimpleBody netcoreapp3.1 394ns 2.06ns 10.5ns 0 0 0 272 B
#5436 ObjectExtractorSimpleBody net472 310ns 0.042ns 0.163ns 0.0434 0 0 281 B
#5436 ObjectExtractorMoreComplexBody net6.0 6.38μs 3.8ns 14.7ns 0 0 0 3.78 KB
#5436 ObjectExtractorMoreComplexBody netcoreapp3.1 7.78μs 33.8ns 122ns 0 0 0 3.69 KB
#5436 ObjectExtractorMoreComplexBody net472 6.86μs 2.93ns 11.4ns 0.585 0 0 3.8 KB
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5436

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs‑net6.0 2.16 KB 2.15 KB -11 B -0.51%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EncodeArgs net6.0 73.3μs 263ns 984ns 0 0 0 32.41 KB
master EncodeArgs netcoreapp3.1 95.7μs 36.2ns 130ns 0 0 0 32.4 KB
master EncodeArgs net472 107μs 17.6ns 65.8ns 4.82 0 0 32.51 KB
master EncodeLegacyArgs net6.0 143μs 122ns 472ns 0 0 0 2.16 KB
master EncodeLegacyArgs netcoreapp3.1 197μs 42.5ns 147ns 0 0 0 2.14 KB
master EncodeLegacyArgs net472 261μs 66.8ns 250ns 0 0 0 2.16 KB
#5436 EncodeArgs net6.0 73.2μs 311ns 1.2μs 0 0 0 32.4 KB
#5436 EncodeArgs netcoreapp3.1 94.6μs 252ns 974ns 0 0 0 32.4 KB
#5436 EncodeArgs net472 106μs 24.9ns 93ns 4.74 0 0 32.51 KB
#5436 EncodeLegacyArgs net6.0 145μs 75.2ns 291ns 0 0 0 2.15 KB
#5436 EncodeLegacyArgs netcoreapp3.1 201μs 574ns 2.22μs 0 0 0 2.14 KB
#5436 EncodeLegacyArgs net472 261μs 20ns 77.6ns 0 0 0 2.16 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 271μs 133ns 499ns 0 0 0 4.55 KB
master RunWafRealisticBenchmark netcoreapp3.1 294μs 264ns 989ns 0 0 0 4.48 KB
master RunWafRealisticBenchmark net472 307μs 38.1ns 147ns 0 0 0 4.66 KB
master RunWafRealisticBenchmarkWithAttack net6.0 181μs 80.1ns 300ns 0 0 0 2.24 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 198μs 104ns 404ns 0 0 0 2.22 KB
master RunWafRealisticBenchmarkWithAttack net472 207μs 45.3ns 169ns 0 0 0 2.28 KB
#5436 RunWafRealisticBenchmark net6.0 272μs 32.2ns 120ns 0 0 0 4.55 KB
#5436 RunWafRealisticBenchmark netcoreapp3.1 297μs 106ns 398ns 0 0 0 4.48 KB
#5436 RunWafRealisticBenchmark net472 309μs 60.6ns 235ns 0 0 0 4.66 KB
#5436 RunWafRealisticBenchmarkWithAttack net6.0 182μs 39.4ns 152ns 0 0 0 2.24 KB
#5436 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 199μs 125ns 484ns 0 0 0 2.22 KB
#5436 RunWafRealisticBenchmarkWithAttack net472 206μs 43.2ns 150ns 0 0 0 2.28 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 61.1μs 29ns 104ns 0 0 0 14.53 KB
master SendRequest netcoreapp3.1 69.9μs 118ns 440ns 0 0 0 17.42 KB
master SendRequest net472 0.0171ns 0.00147ns 0.00551ns 0 0 0 0 b
#5436 SendRequest net6.0 60.8μs 59.8ns 216ns 0 0 0 14.52 KB
#5436 SendRequest netcoreapp3.1 70.7μs 167ns 626ns 0 0 0 17.42 KB
#5436 SendRequest net472 0.0193ns 0.00142ns 0.00549ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #5436

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 41.89 KB 42.34 KB 450 B 1.07%
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 55.75 KB 56.06 KB 302 B 0.54%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 645μs 512ns 1.98μs 0 0 0 41.73 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 631μs 1.67μs 6.67μs 0 0 0 41.89 KB
master WriteAndFlushEnrichedTraces net472 923μs 1.93μs 7.2μs 4.46 0 0 55.75 KB
#5436 WriteAndFlushEnrichedTraces net6.0 659μs 3.87μs 36.5μs 0 0 0 41.58 KB
#5436 WriteAndFlushEnrichedTraces netcoreapp3.1 681μs 5.29μs 51.8μs 0 0 0 42.34 KB
#5436 WriteAndFlushEnrichedTraces net472 934μs 2.98μs 11.1μs 4.46 0 0 56.06 KB
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 1.99μs 10.2ns 46.8ns 0 0 0 1.03 KB
master ExecuteNonQuery netcoreapp3.1 2.53μs 3.43ns 13.3ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.7μs 2.41ns 9.34ns 0.147 0.0134 0 995 B
#5436 ExecuteNonQuery net6.0 1.99μs 1.41ns 5.46ns 0 0 0 1.03 KB
#5436 ExecuteNonQuery netcoreapp3.1 2.53μs 3.04ns 11.8ns 0 0 0 1.02 KB
#5436 ExecuteNonQuery net472 2.75μs 5.74ns 22.2ns 0.151 0.0138 0 995 B
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5436

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑net472 1.11 KB 1.1 KB -8 B -0.72%
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑netcoreapp3.1 1.09 KB 1.08 KB -8 B -0.74%
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net472 1.05 KB 1.04 KB -8 B -0.76%
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net6.0 1.04 KB 1.03 KB -8 B -0.77%
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑netcoreapp3.1 1.04 KB 1.03 KB -8 B -0.77%
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑net6.0 1.02 KB 1.01 KB -8 B -0.79%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.83μs 5.85ns 22.7ns 0 0 0 1.04 KB
master CallElasticsearch netcoreapp3.1 2.3μs 11.8ns 56.6ns 0 0 0 1.04 KB
master CallElasticsearch net472 3.55μs 3.05ns 11.8ns 0.159 0 0 1.05 KB
master CallElasticsearchAsync net6.0 1.81μs 3.89ns 14.5ns 0 0 0 1.02 KB
master CallElasticsearchAsync netcoreapp3.1 2.35μs 7.26ns 28.1ns 0 0 0 1.09 KB
master CallElasticsearchAsync net472 3.84μs 3.19ns 12.4ns 0.169 0 0 1.11 KB
#5436 CallElasticsearch net6.0 1.79μs 8.52ns 33ns 0 0 0 1.03 KB
#5436 CallElasticsearch netcoreapp3.1 2.39μs 7.37ns 26.6ns 0 0 0 1.03 KB
#5436 CallElasticsearch net472 3.66μs 3.59ns 13.9ns 0.165 0 0 1.04 KB
#5436 CallElasticsearchAsync net6.0 1.84μs 7.95ns 30.8ns 0 0 0 1.01 KB
#5436 CallElasticsearchAsync netcoreapp3.1 2.46μs 7.96ns 30.8ns 0 0 0 1.08 KB
#5436 CallElasticsearchAsync net472 3.86μs 5.22ns 20.2ns 0.172 0 0 1.1 KB
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5436

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net6.0 960 B 952 B -8 B -0.83%
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑netcoreapp3.1 960 B 952 B -8 B -0.83%
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net472 923 B 915 B -8 B -0.87%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net6.0 1.78μs 9.27ns 43.5ns 0 0 0 960 B
master ExecuteAsync netcoreapp3.1 2.29μs 7.45ns 25.8ns 0 0 0 960 B
master ExecuteAsync net472 2.58μs 1.78ns 6.88ns 0.143 0 0 923 B
#5436 ExecuteAsync net6.0 1.84μs 3.9ns 15.1ns 0 0 0 952 B
#5436 ExecuteAsync netcoreapp3.1 2.35μs 9.97ns 38.6ns 0 0 0 952 B
#5436 ExecuteAsync net472 2.47μs 1.18ns 4.57ns 0.137 0 0 915 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 7.1μs 10.4ns 39ns 0 0 0 2.37 KB
master SendAsync netcoreapp3.1 8.69μs 14.1ns 54.6ns 0 0 0 2.9 KB
master SendAsync net472 12.5μs 10.3ns 38.5ns 0.498 0 0 3.19 KB
#5436 SendAsync net6.0 6.97μs 19ns 73.6ns 0 0 0 2.36 KB
#5436 SendAsync netcoreapp3.1 8.68μs 17.5ns 67.6ns 0 0 0 2.9 KB
#5436 SendAsync net472 12.4μs 8.03ns 31.1ns 0.496 0 0 3.18 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Slower ⚠️ More allocations ⚠️

Slower ⚠️ in #5436

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 1.218 413,700.00 503,900.00

More allocations ⚠️ in #5436

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1 42.64 KB 86.15 KB 43.51 KB 102.05%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 43.83 KB 46.42 KB 2.59 KB 5.91%

Fewer allocations 🎉 in #5436

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 259.96 KB 256.22 KB -3.74 KB -1.44%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472 286.72 KB 278.53 KB -8.19 KB -2.86%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 274.93 KB 255.96 KB -18.97 KB -6.90%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 44.6μs 212ns 1.6μs 0 0 0 43.83 KB
master StringConcatBenchmark netcoreapp3.1 47.2μs 224ns 838ns 0 0 0 42.64 KB
master StringConcatBenchmark net472 56.8μs 259ns 968ns 0 0 0 57.34 KB
master StringConcatAspectBenchmark net6.0 458μs 1.08μs 3.89μs 0 0 0 259.96 KB
master StringConcatAspectBenchmark netcoreapp3.1 447μs 6.44μs 63.7μs 0 0 0 274.93 KB
master StringConcatAspectBenchmark net472 410μs 2.07μs 9.27μs 0 0 0 286.72 KB
#5436 StringConcatBenchmark net6.0 41.9μs 216ns 1.35μs 0 0 0 46.42 KB
#5436 StringConcatBenchmark netcoreapp3.1 49.1μs 283ns 2.28μs 0 0 0 86.15 KB
#5436 StringConcatBenchmark net472 57.4μs 174ns 675ns 0 0 0 57.34 KB
#5436 StringConcatAspectBenchmark net6.0 452μs 2.09μs 7.55μs 0 0 0 256.22 KB
#5436 StringConcatAspectBenchmark netcoreapp3.1 506μs 2.45μs 10.7μs 0 0 0 255.96 KB
#5436 StringConcatAspectBenchmark net472 411μs 2.25μs 14.3μs 0 0 0 278.53 KB
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5436

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ILoggerBenchmark.EnrichedLog‑net6.0 1.76 KB 1.7 KB -56 B -3.18%
Benchmarks.Trace.ILoggerBenchmark.EnrichedLog‑netcoreapp3.1 1.76 KB 1.7 KB -56 B -3.18%
Benchmarks.Trace.ILoggerBenchmark.EnrichedLog‑net472 1.69 KB 1.64 KB -56 B -3.31%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 2.63μs 2.6ns 10.1ns 0 0 0 1.76 KB
master EnrichedLog netcoreapp3.1 3.44μs 4.38ns 17ns 0 0 0 1.76 KB
master EnrichedLog net472 4.05μs 4.83ns 18.7ns 0.265 0 0 1.69 KB
#5436 EnrichedLog net6.0 2.62μs 4.05ns 15.7ns 0 0 0 1.7 KB
#5436 EnrichedLog netcoreapp3.1 3.58μs 8.41ns 32.6ns 0 0 0 1.7 KB
#5436 EnrichedLog net472 3.93μs 4.77ns 18.5ns 0.254 0 0 1.64 KB
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5436

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Log4netBenchmark.EnrichedLog‑net6.0 4.37 KB 4.31 KB -57 B -1.30%
Benchmarks.Trace.Log4netBenchmark.EnrichedLog‑net472 4.57 KB 4.51 KB -60 B -1.31%
Benchmarks.Trace.Log4netBenchmark.EnrichedLog‑netcoreapp3.1 4.37 KB 4.31 KB -58 B -1.33%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 123μs 145ns 563ns 0 0 0 4.37 KB
master EnrichedLog netcoreapp3.1 126μs 330ns 1.24μs 0 0 0 4.37 KB
master EnrichedLog net472 167μs 161ns 603ns 0 0 0 4.57 KB
#5436 EnrichedLog net6.0 123μs 259ns 970ns 0 0 0 4.31 KB
#5436 EnrichedLog netcoreapp3.1 128μs 296ns 1.15μs 0 0 0 4.31 KB
#5436 EnrichedLog net472 166μs 154ns 595ns 0 0 0 4.51 KB
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5436

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.NLogBenchmark.EnrichedLog‑net6.0 2.32 KB 2.26 KB -56 B -2.41%
Benchmarks.Trace.NLogBenchmark.EnrichedLog‑netcoreapp3.1 2.32 KB 2.26 KB -56 B -2.41%
Benchmarks.Trace.NLogBenchmark.EnrichedLog‑net472 2.14 KB 2.08 KB -56 B -2.62%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 4.94μs 19.3ns 74.6ns 0 0 0 2.32 KB
master EnrichedLog netcoreapp3.1 6.77μs 22.2ns 79.9ns 0 0 0 2.32 KB
master EnrichedLog net472 7.45μs 8.04ns 31.1ns 0.335 0 0 2.14 KB
#5436 EnrichedLog net6.0 5.02μs 19.1ns 74ns 0 0 0 2.26 KB
#5436 EnrichedLog netcoreapp3.1 6.62μs 17.5ns 65.3ns 0 0 0 2.26 KB
#5436 EnrichedLog net472 7.5μs 8.59ns 33.3ns 0.302 0 0 2.08 KB
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5436

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.RedisBenchmark.SendReceive‑net472 1.21 KB 1.2 KB -8 B -0.66%
Benchmarks.Trace.RedisBenchmark.SendReceive‑net6.0 1.21 KB 1.2 KB -8 B -0.66%
Benchmarks.Trace.RedisBenchmark.SendReceive‑netcoreapp3.1 1.21 KB 1.2 KB -8 B -0.66%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net6.0 2.04μs 10.5ns 49.4ns 0 0 0 1.21 KB
master SendReceive netcoreapp3.1 2.53μs 11.8ns 47.4ns 0 0 0 1.21 KB
master SendReceive net472 3.28μs 2.71ns 10.5ns 0.178 0 0 1.21 KB
#5436 SendReceive net6.0 2.02μs 1.22ns 4.72ns 0 0 0 1.2 KB
#5436 SendReceive netcoreapp3.1 2.66μs 8.72ns 33.8ns 0 0 0 1.2 KB
#5436 SendReceive net472 3.08μs 6.28ns 24.3ns 0.186 0 0 1.2 KB
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5436

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.SerilogBenchmark.EnrichedLog‑net472 2.08 KB 2.03 KB -56 B -2.69%
Benchmarks.Trace.SerilogBenchmark.EnrichedLog‑netcoreapp3.1 1.69 KB 1.63 KB -56 B -3.32%
Benchmarks.Trace.SerilogBenchmark.EnrichedLog‑net6.0 1.64 KB 1.58 KB -56 B -3.41%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 4.18μs 0.92ns 3.44ns 0 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 5.64μs 23ns 89.3ns 0 0 0 1.69 KB
master EnrichedLog net472 6.67μs 7.28ns 27.3ns 0.298 0 0 2.08 KB
#5436 EnrichedLog net6.0 4.16μs 16.5ns 64ns 0 0 0 1.58 KB
#5436 EnrichedLog netcoreapp3.1 5.62μs 9.27ns 35.9ns 0 0 0 1.63 KB
#5436 EnrichedLog net472 6.57μs 7.43ns 28.8ns 0.295 0 0 2.03 KB
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5436

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 704 B 696 B -8 B -1.14%
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑netcoreapp3.1 704 B 696 B -8 B -1.14%
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net472 666 B 658 B -8 B -1.20%
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net472 586 B 578 B -8 B -1.37%
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 584 B 576 B -8 B -1.37%
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 584 B 576 B -8 B -1.37%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 751ns 3.97ns 22.4ns 0 0 0 584 B
master StartFinishSpan netcoreapp3.1 953ns 4.42ns 17.7ns 0 0 0 584 B
master StartFinishSpan net472 914ns 0.809ns 3.13ns 0.0912 0 0 586 B
master StartFinishScope net6.0 918ns 0.479ns 1.73ns 0 0 0 704 B
master StartFinishScope netcoreapp3.1 1.15μs 6.24ns 34.2ns 0 0 0 704 B
master StartFinishScope net472 1.09μs 0.174ns 0.652ns 0.104 0 0 666 B
#5436 StartFinishSpan net6.0 753ns 3.47ns 15.5ns 0 0 0 576 B
#5436 StartFinishSpan netcoreapp3.1 963ns 5.15ns 28.2ns 0 0 0 576 B
#5436 StartFinishSpan net472 928ns 0.136ns 0.509ns 0.088 0 0 578 B
#5436 StartFinishScope net6.0 916ns 0.255ns 0.92ns 0 0 0 696 B
#5436 StartFinishScope netcoreapp3.1 1.18μs 5.89ns 27ns 0 0 0 696 B
#5436 StartFinishScope net472 1.11μs 0.437ns 1.58ns 0.0994 0 0 658 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5436

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 704 B 696 B -8 B -1.14%
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑netcoreapp3.1 704 B 696 B -8 B -1.14%
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net472 666 B 658 B -8 B -1.20%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 1.02μs 5.36ns 26.8ns 0 0 0 704 B
master RunOnMethodBegin netcoreapp3.1 1.38μs 2.28ns 8.82ns 0 0 0 704 B
master RunOnMethodBegin net472 1.36μs 0.141ns 0.544ns 0.102 0 0 666 B
#5436 RunOnMethodBegin net6.0 1.06μs 5.79ns 32.8ns 0 0 0 696 B
#5436 RunOnMethodBegin netcoreapp3.1 1.45μs 7.1ns 28.4ns 0 0 0 696 B
#5436 RunOnMethodBegin net472 1.46μs 1.59ns 6.16ns 0.0977 0 0 658 B

Copy link
Contributor

Snapshots difference summary

The following differences have been observed in committed snapshots. It is meant to help the reviewer.
The diff is simplistic, so please check some files anyway while we improve it.

1 occurrences of :

+  {
+    TraceId: Id_66,
+    SpanId: Id_67,
+    Name: postgres.query,
+    Resource: DROP TABLE IF EXISTS my_table;CREATE TABLE my_table (Id int PRIMARY KEY, Name varchar(100));INSERT INTO my_table (Id, Name) VALUES (@Id, @Name),
+    Service: Samples.Npgsql-postgres,
+    Type: sql,
+    ParentId: Id_68,
+    Tags: {
+      component: Npgsql,
+      db.name: postgres,
+      db.operation.batch.size: 3,
+      db.type: postgres,
+      env: integration_tests,
+      language: dotnet,
+      out.host: postgres,
+      runtime-id: Guid_1,
+      span.kind: client,
+      _dd.base_service: Samples.Npgsql,
+      _dd.dbm_trace_injected: true
+    },
+    Metrics: {
+      _dd.top_level: 1.0
+    }
+  },
[...]
-    SpanId: Id_66,
+    SpanId: Id_69,

4 occurrences of :

-    SpanId: Id_67,
+    SpanId: Id_70,

4 occurrences of :

-    SpanId: Id_68,
+    SpanId: Id_71,

4 occurrences of :

-    SpanId: Id_69,
+    SpanId: Id_72,

4 occurrences of :

-    SpanId: Id_70,
+    SpanId: Id_73,

4 occurrences of :

-    SpanId: Id_71,
+    SpanId: Id_74,

4 occurrences of :

-    SpanId: Id_72,
+    SpanId: Id_75,

4 occurrences of :

-    SpanId: Id_73,
+    SpanId: Id_76,

4 occurrences of :

-    SpanId: Id_74,
+    SpanId: Id_77,

4 occurrences of :

-    SpanId: Id_75,
+    SpanId: Id_78,

4 occurrences of :

-    SpanId: Id_76,
+    SpanId: Id_79,

4 occurrences of :

-    SpanId: Id_77,
+    SpanId: Id_80,

4 occurrences of :

-    SpanId: Id_78,
+    SpanId: Id_81,

4 occurrences of :

-    SpanId: Id_79,
+    SpanId: Id_82,

4 occurrences of :

-    SpanId: Id_80,
+    SpanId: Id_83,

4 occurrences of :

-    SpanId: Id_81,
+    SpanId: Id_84,

4 occurrences of :

-    SpanId: Id_82,
+    SpanId: Id_85,

4 occurrences of :

-    SpanId: Id_83,
+    SpanId: Id_86,

4 occurrences of :

-    SpanId: Id_84,
+    SpanId: Id_87,

4 occurrences of :

-    SpanId: Id_85,
+    SpanId: Id_88,

4 occurrences of :

-    SpanId: Id_86,
+    SpanId: Id_89,

4 occurrences of :

-    SpanId: Id_87,
+    SpanId: Id_90,

4 occurrences of :

-    SpanId: Id_88,
+    SpanId: Id_91,

4 occurrences of :

-    SpanId: Id_89,
+    SpanId: Id_92,

4 occurrences of :

-    SpanId: Id_90,
+    SpanId: Id_93,

4 occurrences of :

-    SpanId: Id_91,
+    SpanId: Id_94,

4 occurrences of :

-    SpanId: Id_92,
+    SpanId: Id_95,

4 occurrences of :

-    SpanId: Id_93,
+    SpanId: Id_96,

4 occurrences of :

-    SpanId: Id_94,
+    SpanId: Id_97,

4 occurrences of :

-    SpanId: Id_95,
+    SpanId: Id_98,

4 occurrences of :

-    SpanId: Id_96,
+    SpanId: Id_99,

4 occurrences of :

-    SpanId: Id_97,
+    SpanId: Id_100,

4 occurrences of :

-    SpanId: Id_98,
+    SpanId: Id_101,

4 occurrences of :

-    SpanId: Id_99,
+    SpanId: Id_102,

4 occurrences of :

-    SpanId: Id_100,
+    SpanId: Id_103,

4 occurrences of :

-    SpanId: Id_101,
+    SpanId: Id_104,

4 occurrences of :

-    SpanId: Id_102,
+    SpanId: Id_105,

4 occurrences of :

-    SpanId: Id_103,
+    SpanId: Id_106,

4 occurrences of :

-    SpanId: Id_104,
+    SpanId: Id_107,

4 occurrences of :

-    SpanId: Id_105,
+    SpanId: Id_108,

4 occurrences of :

-    SpanId: Id_106,
+    SpanId: Id_109,

4 occurrences of :

-    SpanId: Id_107,
+    SpanId: Id_110,

4 occurrences of :

-    SpanId: Id_108,
+    SpanId: Id_111,

4 occurrences of :

-    SpanId: Id_109,
+    SpanId: Id_112,

4 occurrences of :

-    SpanId: Id_110,
+    SpanId: Id_113,

4 occurrences of :

-    SpanId: Id_111,
+    SpanId: Id_114,

4 occurrences of :

-    SpanId: Id_112,
+    SpanId: Id_115,

4 occurrences of :

-    SpanId: Id_113,
+    SpanId: Id_116,

4 occurrences of :

-    SpanId: Id_114,
+    SpanId: Id_117,

4 occurrences of :

-    SpanId: Id_115,
+    SpanId: Id_118,

4 occurrences of :

-    SpanId: Id_116,
+    SpanId: Id_119,

4 occurrences of :

-    SpanId: Id_117,
+    SpanId: Id_120,

4 occurrences of :

-    SpanId: Id_118,
+    SpanId: Id_121,

4 occurrences of :

-    SpanId: Id_119,
+    SpanId: Id_122,

4 occurrences of :

-    SpanId: Id_120,
+    SpanId: Id_123,

4 occurrences of :

-    SpanId: Id_121,
+    SpanId: Id_124,

4 occurrences of :

-    SpanId: Id_122,
+    SpanId: Id_125,

4 occurrences of :

-    SpanId: Id_123,
+    SpanId: Id_126,

4 occurrences of :

-    SpanId: Id_124,
+    SpanId: Id_127,

4 occurrences of :

-    SpanId: Id_125,
+    SpanId: Id_128,

4 occurrences of :

-    SpanId: Id_126,
+    SpanId: Id_129,

4 occurrences of :

-    SpanId: Id_127,
+    SpanId: Id_130,

4 occurrences of :

-    SpanId: Id_128,
+    SpanId: Id_131,

4 occurrences of :

-    SpanId: Id_129,
+    SpanId: Id_132,

4 occurrences of :

-    SpanId: Id_130,
+    SpanId: Id_133,

4 occurrences of :

-    SpanId: Id_131,
+    SpanId: Id_134,

4 occurrences of :

-    SpanId: Id_132,
+    SpanId: Id_135,

4 occurrences of :

-    SpanId: Id_133,
+    SpanId: Id_136,

4 occurrences of :

-    SpanId: Id_134,
+    SpanId: Id_137,

4 occurrences of :

-    SpanId: Id_135,
+    SpanId: Id_138,

4 occurrences of :

-    SpanId: Id_136,
+    SpanId: Id_139,

4 occurrences of :

-    SpanId: Id_137,
+    SpanId: Id_140,

4 occurrences of :

-    SpanId: Id_138,
+    SpanId: Id_141,

4 occurrences of :

-    SpanId: Id_139,
+    SpanId: Id_142,

4 occurrences of :

-    SpanId: Id_140,
+    SpanId: Id_143,

4 occurrences of :

-    SpanId: Id_141,
+    SpanId: Id_144,

4 occurrences of :

-    SpanId: Id_142,
+    SpanId: Id_145,

4 occurrences of :

-    SpanId: Id_143,
+    SpanId: Id_146,

4 occurrences of :

-    SpanId: Id_144,
+    SpanId: Id_147,

4 occurrences of :

-    SpanId: Id_145,
+    SpanId: Id_148,

4 occurrences of :

-    SpanId: Id_146,
+    SpanId: Id_149,

4 occurrences of :

-    SpanId: Id_147,
+    SpanId: Id_150,

4 occurrences of :

-    SpanId: Id_148,
+    SpanId: Id_151,

4 occurrences of :

-    SpanId: Id_149,
+    SpanId: Id_152,

4 occurrences of :

-    SpanId: Id_150,
+    SpanId: Id_153,

4 occurrences of :

-    SpanId: Id_151,
+    SpanId: Id_154,

4 occurrences of :

-    SpanId: Id_152,
+    SpanId: Id_155,

4 occurrences of :

-    SpanId: Id_153,
+    SpanId: Id_156,

4 occurrences of :

-    SpanId: Id_154,
+    SpanId: Id_157,

4 occurrences of :

-    SpanId: Id_155,
+    SpanId: Id_158,

4 occurrences of :

-    SpanId: Id_156,
+    SpanId: Id_159,

4 occurrences of :

-    SpanId: Id_157,
+    SpanId: Id_160,

4 occurrences of :

-    SpanId: Id_158,
+    SpanId: Id_161,

4 occurrences of :

-    SpanId: Id_159,
+    SpanId: Id_162,

4 occurrences of :

-    SpanId: Id_160,
+    SpanId: Id_163,

4 occurrences of :

-    SpanId: Id_161,
+    SpanId: Id_164,

4 occurrences of :

-    SpanId: Id_162,
+    SpanId: Id_165,

4 occurrences of :

-    SpanId: Id_163,
+    SpanId: Id_166,

4 occurrences of :

-    SpanId: Id_164,
+    SpanId: Id_167,

4 occurrences of :

-    SpanId: Id_165,
+    SpanId: Id_168,

4 occurrences of :

-    SpanId: Id_166,
+    SpanId: Id_169,

4 occurrences of :

-    SpanId: Id_167,
+    SpanId: Id_170,

4 occurrences of :

-    SpanId: Id_168,
+    SpanId: Id_171,

4 occurrences of :

-    SpanId: Id_169,
+    SpanId: Id_172,

4 occurrences of :

-    SpanId: Id_170,
+    SpanId: Id_173,

1 occurrences of :

+  {
+    TraceId: Id_66,
+    SpanId: Id_67,
+    Name: postgres.query,
+    Resource: DROP TABLE IF EXISTS my_table;CREATE TABLE my_table (Id int PRIMARY KEY, Name varchar(100));INSERT INTO my_table (Id, Name) VALUES (@Id, @Name),
+    Service: Samples.Npgsql,
+    Type: sql,
+    ParentId: Id_68,
+    Tags: {
+      component: Npgsql,
+      db.name: postgres,
+      db.operation.batch.size: 3,
+      db.type: postgres,
+      env: integration_tests,
+      language: dotnet,
+      out.host: postgres,
+      peer.service: postgres,
+      span.kind: client,
+      version: 1.0.0,
+      _dd.dbm_trace_injected: true,
+      _dd.peer.service.source: db.name
+    }
+  },
[...]
-    SpanId: Id_66,
+    SpanId: Id_69,

1 occurrences of :

+  {
+    TraceId: Id_66,
+    SpanId: Id_67,
+    Name: postgres.query,
+    Resource: DROP TABLE IF EXISTS my_table;CREATE TABLE my_table (Id int PRIMARY KEY, Name varchar(100));INSERT INTO my_table (Id, Name) VALUES (@Id, @Name),
+    Service: Samples.Npgsql-postgres,
+    Type: sql,
+    ParentId: Id_68,
+    Tags: {
+      component: Npgsql,
+      db.name: postgres,
+      db.operation.batch.size: 3,
+      db.type: postgres,
+      env: integration_tests,
+      language: dotnet,
+      out.host: postgres,
+      runtime-id: Guid_1,
+      span.kind: client,
+      _dd.base_service: Samples.Npgsql
+    },
+    Metrics: {
+      _dd.top_level: 1.0
+    }
+  },
[...]
-    SpanId: Id_66,
+    SpanId: Id_69,

1 occurrences of :

+  {
+    TraceId: Id_66,
+    SpanId: Id_67,
+    Name: postgres.query,
+    Resource: DROP TABLE IF EXISTS my_table;CREATE TABLE my_table (Id int PRIMARY KEY, Name varchar(100));INSERT INTO my_table (Id, Name) VALUES (@Id, @Name),
+    Service: Samples.Npgsql,
+    Type: sql,
+    ParentId: Id_68,
+    Tags: {
+      component: Npgsql,
+      db.name: postgres,
+      db.operation.batch.size: 3,
+      db.type: postgres,
+      env: integration_tests,
+      language: dotnet,
+      out.host: postgres,
+      peer.service: postgres,
+      span.kind: client,
+      version: 1.0.0,
+      _dd.peer.service.source: db.name
+    }
+  },
[...]
-    SpanId: Id_66,
+    SpanId: Id_69,

@vandonr
Copy link
Contributor Author

vandonr commented Jun 20, 2025

I did my best at readying this, but there is still some work to be done in integration tests to make sure we have good coverage on this new feature.
I'm going on leave for 2.5 months now, so someone from the team might pick it up or not 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants