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

Add ability to disable additional ADO.NET Command Types #6042

Merged
merged 6 commits into from
Oct 21, 2024
Merged

Conversation

bouwkast
Copy link
Contributor

@bouwkast bouwkast commented Sep 17, 2024

Summary of changes

Allows users to configure additionally ADO.NET DbCommands to be disabled so they won't have a Span created from them.

Reason for change

Since we instrument basically any DbCommand in ADO.NET this can lead to unwanted/duplicate Spans that customers have little control over. This allows for a comma-separated list of command type names that the .NET Tracer will not create a Span for if they encounter it.

Implementation details

Adds new Environment Variable DD_TRACE_DISABLED_ADONET_COMMAND_TYPES that accepts a comma-separated string of ADO.NET Command Type names that the Tracer will not create a Span for.

For example (some pseudo-code here):

Assuming we have a custom DbCommand FooDbCommand that we don't want Spans for ->

public class FooDbCommand : DbCommand
{
    ... class contents here
}

We'd need to set DD_TRACE_DISABLED_ADONET_COMMAND_TYPES to ->

DD_TRACE_DISABLED_ADONET_COMMAND_TYPES="FooDbCommand"

Test coverage

  • Extended current DbScopeFactoryTests to add new value.
  • Extended FakeCommandTests to include disabling of FakeCommand
  • Snapshotted those tests as well.

Other details

Merge the dd-go PR when this PR is merged: https://github.com/DataDog/dd-go/pull/150493

Backported to 2.x in #6054

@bouwkast bouwkast requested review from a team as code owners September 17, 2024 13:29
@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Sep 17, 2024

Datadog Report

Branch report: steven/29781
Commit report: 861e936
Test service: dd-trace-dotnet

✅ 0 Failed, 361588 Passed, 2064 Skipped, 14h 57m 18.83s Total Time

@andrewlock
Copy link
Member

andrewlock commented Sep 17, 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 (6042) - mean (69ms)  : 67, 71
     .   : milestone, 69,
    master - mean (70ms)  : 67, 72
     .   : milestone, 70,

    section CallTarget+Inlining+NGEN
    This PR (6042) - mean (1,111ms)  : 1094, 1129
     .   : milestone, 1111,
    master - mean (1,110ms)  : 1085, 1135
     .   : milestone, 1110,

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

    section CallTarget+Inlining+NGEN
    This PR (6042) - mean (771ms)  : 756, 787
     .   : milestone, 771,
    master - mean (771ms)  : 757, 786
     .   : milestone, 771,

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

    section CallTarget+Inlining+NGEN
    This PR (6042) - mean (725ms)  : 707, 743
     .   : milestone, 725,
    master - mean (727ms)  : 710, 744
     .   : milestone, 727,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6042) - mean (189ms)  : 185, 192
     .   : milestone, 189,
    master - mean (189ms)  : 186, 192
     .   : milestone, 189,

    section CallTarget+Inlining+NGEN
    This PR (6042) - mean (1,196ms)  : 1172, 1221
     .   : milestone, 1196,
    master - mean (1,201ms)  : 1179, 1222
     .   : milestone, 1201,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6042) - mean (274ms)  : 271, 277
     .   : milestone, 274,
    master - mean (274ms)  : 269, 278
     .   : milestone, 274,

    section CallTarget+Inlining+NGEN
    This PR (6042) - mean (941ms)  : 921, 961
     .   : milestone, 941,
    master - mean (943ms)  : 926, 960
     .   : milestone, 943,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6042) - mean (263ms)  : 259, 267
     .   : milestone, 263,
    master - mean (263ms)  : 259, 267
     .   : milestone, 263,

    section CallTarget+Inlining+NGEN
    This PR (6042) - mean (923ms)  : 902, 945
     .   : milestone, 923,
    master - mean (924ms)  : 908, 940
     .   : milestone, 924,

Loading

@@ -198,6 +198,31 @@ _ when commandTypeName.EndsWith(commandSuffix) =>
}
}

internal static bool IsDisabledCommandType(string commandTypeName)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we instead pass the Tracer object through the method parameters so this method doesn't rely on the static Tracer.Instance? WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good to me!
Needed to propagate the parameter up a bit as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has proven to be a bit of a headache as I have ultimately needed to pass Tracer.Instance to the static Cache class

Without doing more refactoring I may just revert this and depend on the static Tracer.Instance for now and come back later to refactor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah @zacharycmontoya I've reverted this, I'll look at it later (follow up PR) if that sounds okay?

Copy link
Collaborator

@zacharycmontoya zacharycmontoya left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@andrewlock
Copy link
Member

andrewlock commented Sep 17, 2024

Throughput/Crank Report ⚡

Throughput results for AspNetCoreSimpleController comparing the following branches/commits:

Cases where throughput results for the PR are worse than latest master (5% drop or greater), results are shown in red.

Note that these results are based on a single point-in-time result for each branch. For full results, see one of the many, many dashboards!

gantt
    title Throughput Linux x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6042) (11.055M)   : 0, 11055070
    master (11.252M)   : 0, 11251784
    benchmarks/2.9.0 (11.081M)   : 0, 11080577

    section Automatic
    This PR (6042) (7.408M)   : 0, 7407652
    master (7.466M)   : 0, 7465753
    benchmarks/2.9.0 (7.732M)   : 0, 7732233

    section Trace stats
    master (7.766M)   : 0, 7765791

    section Manual
    master (11.114M)   : 0, 11114354

    section Manual + Automatic
    This PR (6042) (6.769M)   : 0, 6768593
    master (6.846M)   : 0, 6845872

    section DD_TRACE_ENABLED=0
    master (10.389M)   : 0, 10388612

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6042) (9.499M)   : 0, 9498913
    master (9.539M)   : 0, 9539093
    benchmarks/2.9.0 (9.798M)   : 0, 9798067

    section Automatic
    This PR (6042) (6.675M)   : 0, 6675432
    master (6.648M)   : 0, 6647799

    section Trace stats
    master (6.855M)   : 0, 6855301

    section Manual
    master (9.525M)   : 0, 9525425

    section Manual + Automatic
    This PR (6042) (6.260M)   : 0, 6259685
    master (6.161M)   : 0, 6160600

    section DD_TRACE_ENABLED=0
    master (8.832M)   : 0, 8832117

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6042) (10.397M)   : 0, 10397111
    master (10.064M)   : 0, 10064242
    benchmarks/2.9.0 (10.067M)   : 0, 10067315

    section Automatic
    This PR (6042) (6.814M)   : 0, 6813678
    master (6.841M)   : 0, 6841333
    benchmarks/2.9.0 (7.552M)   : 0, 7552193

    section Trace stats
    master (7.427M)   : 0, 7426854

    section Manual
    master (10.084M)   : 0, 10084210

    section Manual + Automatic
    This PR (6042) (6.381M)   : 0, 6380607
    master (6.348M)   : 0, 6347556

    section DD_TRACE_ENABLED=0
    master (9.577M)   : 0, 9576577

Loading

@andrewlock
Copy link
Member

andrewlock commented Sep 17, 2024

Benchmarks Report for tracer 🐌

Benchmarks for #6042 compared to master:

  • 2 benchmarks are faster, with geometric mean 1.156
  • 1 benchmarks are slower, with geometric mean 1.166
  • 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 ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 7.48μs 38ns 166ns 0.0187 0.00748 0 5.43 KB
master StartStopWithChild netcoreapp3.1 10μs 54.5ns 304ns 0.0202 0.0101 0 5.62 KB
master StartStopWithChild net472 16.8μs 54.6ns 212ns 1.06 0.353 0.109 6.07 KB
#6042 StartStopWithChild net6.0 7.8μs 45.1ns 358ns 0.0126 0.00419 0 5.43 KB
#6042 StartStopWithChild netcoreapp3.1 10.2μs 56.3ns 360ns 0.0199 0.00994 0 5.62 KB
#6042 StartStopWithChild net472 16.6μs 72.5ns 281ns 1.01 0.289 0.0964 6.07 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 478μs 477ns 1.78μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 635μs 310ns 1.2μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 840μs 803ns 3.11μs 0.422 0 0 3.3 KB
#6042 WriteAndFlushEnrichedTraces net6.0 506μs 271ns 977ns 0 0 0 2.7 KB
#6042 WriteAndFlushEnrichedTraces netcoreapp3.1 657μs 241ns 902ns 0 0 0 2.7 KB
#6042 WriteAndFlushEnrichedTraces net472 846μs 458ns 1.71μs 0.419 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 210μs 1.2μs 9.04μs 0.205 0 0 18.45 KB
master SendRequest netcoreapp3.1 234μs 1.34μs 10μs 0.226 0 0 20.61 KB
master SendRequest net472 0.0318ns 0.00862ns 0.0334ns 0 0 0 0 b
#6042 SendRequest net6.0 225μs 1.3μs 11.6μs 0.209 0 0 18.46 KB
#6042 SendRequest netcoreapp3.1 232μs 1.31μs 8.48μs 0.231 0 0 20.61 KB
#6042 SendRequest net472 0.00332ns 0.00145ns 0.0056ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 555μs 2.98μs 16.3μs 0.571 0 0 41.56 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 730μs 3.84μs 18.8μs 0.345 0 0 41.74 KB
master WriteAndFlushEnrichedTraces net472 873μs 4.28μs 17.6μs 8.25 2.6 0.434 53.31 KB
#6042 WriteAndFlushEnrichedTraces net6.0 568μs 2.87μs 12.5μs 0.563 0 0 41.52 KB
#6042 WriteAndFlushEnrichedTraces netcoreapp3.1 685μs 3.38μs 13.9μs 0.349 0 0 41.88 KB
#6042 WriteAndFlushEnrichedTraces net472 875μs 4.73μs 26.3μs 8.08 2.55 0.425 53.33 KB
Benchmarks.Trace.DbCommandBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #6042

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑net6.0 1.122 1,340.15 1,193.92

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 1.34μs 1.36ns 5.08ns 0.0141 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.8μs 1.46ns 5.46ns 0.0135 0 0 1.02 KB
master ExecuteNonQuery net472 2.14μs 5ns 19.4ns 0.156 0 0 987 B
#6042 ExecuteNonQuery net6.0 1.19μs 1.55ns 5.98ns 0.0143 0 0 1.02 KB
#6042 ExecuteNonQuery netcoreapp3.1 1.77μs 1.61ns 6.23ns 0.0133 0 0 1.02 KB
#6042 ExecuteNonQuery net472 2.04μs 2.67ns 10.3ns 0.156 0 0 987 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.23μs 0.85ns 3.29ns 0.0136 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.5μs 0.981ns 3.67ns 0.0127 0 0 976 B
master CallElasticsearch net472 2.57μs 0.728ns 2.82ns 0.158 0 0 995 B
master CallElasticsearchAsync net6.0 1.3μs 0.797ns 2.98ns 0.0137 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.64μs 0.844ns 3.16ns 0.014 0 0 1.02 KB
master CallElasticsearchAsync net472 2.56μs 0.937ns 3.51ns 0.167 0 0 1.05 KB
#6042 CallElasticsearch net6.0 1.24μs 0.966ns 3.61ns 0.0136 0 0 976 B
#6042 CallElasticsearch netcoreapp3.1 1.44μs 0.807ns 2.91ns 0.013 0 0 976 B
#6042 CallElasticsearch net472 2.52μs 1.07ns 3.85ns 0.158 0 0 995 B
#6042 CallElasticsearchAsync net6.0 1.29μs 0.71ns 2.66ns 0.0129 0 0 952 B
#6042 CallElasticsearchAsync netcoreapp3.1 1.61μs 0.477ns 1.79ns 0.0136 0 0 1.02 KB
#6042 CallElasticsearchAsync net472 2.56μs 4.19ns 16.2ns 0.166 0 0 1.05 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.31μs 0.726ns 2.72ns 0.0132 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.59μs 0.742ns 2.78ns 0.0126 0 0 952 B
master ExecuteAsync net472 1.8μs 1.2ns 4.65ns 0.145 0 0 915 B
#6042 ExecuteAsync net6.0 1.28μs 0.836ns 3.13ns 0.0135 0 0 952 B
#6042 ExecuteAsync netcoreapp3.1 1.64μs 0.773ns 2.89ns 0.0124 0 0 952 B
#6042 ExecuteAsync net472 1.8μs 1.24ns 4.81ns 0.145 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 4.22μs 2.86ns 10.7ns 0.03 0 0 2.22 KB
master SendAsync netcoreapp3.1 5.05μs 2.54ns 9.82ns 0.038 0 0 2.76 KB
master SendAsync net472 7.73μs 1.98ns 7.39ns 0.499 0 0 3.15 KB
#6042 SendAsync net6.0 4.07μs 2.03ns 7.87ns 0.0306 0 0 2.22 KB
#6042 SendAsync netcoreapp3.1 5.15μs 2.46ns 9.54ns 0.0361 0 0 2.76 KB
#6042 SendAsync net472 7.72μs 2.12ns 8.22ns 0.5 0 0 3.15 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.61μs 0.783ns 3.03ns 0.0225 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.21μs 1.34ns 5.18ns 0.0211 0 0 1.64 KB
master EnrichedLog net472 2.59μs 0.994ns 3.72ns 0.249 0 0 1.57 KB
#6042 EnrichedLog net6.0 1.47μs 2.46ns 8.52ns 0.0233 0 0 1.64 KB
#6042 EnrichedLog netcoreapp3.1 2.22μs 1.75ns 6.77ns 0.0221 0 0 1.64 KB
#6042 EnrichedLog net472 2.63μs 1.26ns 4.87ns 0.249 0 0 1.57 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 118μs 110ns 396ns 0.0579 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 122μs 109ns 422ns 0 0 0 4.28 KB
master EnrichedLog net472 153μs 115ns 446ns 0.681 0.227 0 4.46 KB
#6042 EnrichedLog net6.0 116μs 123ns 474ns 0.0581 0 0 4.28 KB
#6042 EnrichedLog netcoreapp3.1 122μs 182ns 704ns 0 0 0 4.28 KB
#6042 EnrichedLog net472 153μs 122ns 473ns 0.687 0.229 0 4.46 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.09μs 2.94ns 11.4ns 0.0309 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.16μs 2.7ns 10.4ns 0.0292 0 0 2.2 KB
master EnrichedLog net472 4.83μs 1.42ns 5.32ns 0.32 0 0 2.02 KB
#6042 EnrichedLog net6.0 2.95μs 0.614ns 2.3ns 0.0312 0 0 2.2 KB
#6042 EnrichedLog netcoreapp3.1 4.26μs 1.56ns 5.82ns 0.0298 0 0 2.2 KB
#6042 EnrichedLog net472 4.82μs 2.08ns 8.06ns 0.319 0 0 2.02 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.4μs 0.594ns 2.22ns 0.0161 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.84μs 0.842ns 3.26ns 0.0147 0 0 1.14 KB
master SendReceive net472 2.03μs 1.79ns 6.69ns 0.184 0.00101 0 1.16 KB
#6042 SendReceive net6.0 1.48μs 0.683ns 2.64ns 0.0162 0 0 1.14 KB
#6042 SendReceive netcoreapp3.1 1.77μs 1.05ns 4.06ns 0.015 0 0 1.14 KB
#6042 SendReceive net472 2.11μs 0.554ns 2.07ns 0.183 0.00105 0 1.16 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.67μs 1.11ns 4.29ns 0.0228 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 4.03μs 3.13ns 12.1ns 0.022 0 0 1.65 KB
master EnrichedLog net472 4.32μs 2.05ns 7.66ns 0.322 0 0 2.04 KB
#6042 EnrichedLog net6.0 2.69μs 1.33ns 5.17ns 0.023 0 0 1.6 KB
#6042 EnrichedLog netcoreapp3.1 3.79μs 1.7ns 6.6ns 0.0209 0 0 1.65 KB
#6042 EnrichedLog net472 4.34μs 1.59ns 6.15ns 0.323 0 0 2.04 KB
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #6042

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 1.166 543.13 633.47

Faster 🎉 in #6042

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 1.191 479.65 402.70

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 480ns 0.291ns 1.13ns 0.00816 0 0 576 B
master StartFinishSpan netcoreapp3.1 543ns 0.459ns 1.78ns 0.00788 0 0 576 B
master StartFinishSpan net472 685ns 0.476ns 1.84ns 0.0918 0 0 578 B
master StartFinishScope net6.0 575ns 0.29ns 1.12ns 0.00978 0 0 696 B
master StartFinishScope netcoreapp3.1 757ns 0.357ns 1.38ns 0.00949 0 0 696 B
master StartFinishScope net472 908ns 0.464ns 1.8ns 0.105 0 0 658 B
#6042 StartFinishSpan net6.0 403ns 0.23ns 0.89ns 0.00811 0 0 576 B
#6042 StartFinishSpan netcoreapp3.1 633ns 0.452ns 1.69ns 0.00761 0 0 576 B
#6042 StartFinishSpan net472 750ns 0.535ns 2.07ns 0.0915 0 0 578 B
#6042 StartFinishScope net6.0 551ns 0.277ns 1ns 0.00965 0 0 696 B
#6042 StartFinishScope netcoreapp3.1 722ns 0.538ns 2.01ns 0.00918 0 0 696 B
#6042 StartFinishScope net472 895ns 0.563ns 2.18ns 0.105 0 0 658 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 661ns 0.901ns 3.37ns 0.00967 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 917ns 0.471ns 1.76ns 0.00917 0 0 696 B
master RunOnMethodBegin net472 1.19μs 0.895ns 3.35ns 0.104 0 0 658 B
#6042 RunOnMethodBegin net6.0 731ns 0.302ns 1.13ns 0.00958 0 0 696 B
#6042 RunOnMethodBegin netcoreapp3.1 986ns 0.448ns 1.74ns 0.00934 0 0 696 B
#6042 RunOnMethodBegin net472 1.2μs 0.835ns 3.12ns 0.104 0 0 658 B

@bouwkast bouwkast force-pushed the steven/29781 branch 2 times, most recently from c88fe61 to 846624f Compare September 18, 2024 16:28
@bouwkast bouwkast added the status:do-not-merge Work is done. Can review, but do not merge yet. label Sep 18, 2024
@bouwkast
Copy link
Contributor Author

Adding do-not-merge as we are testing this out.

@bouwkast bouwkast removed the status:do-not-merge Work is done. Can review, but do not merge yet. label Oct 7, 2024
bouwkast added a commit that referenced this pull request Oct 21, 2024
…#6054)

## Summary of changes

Allows users to configure _additional_ `ADO.NET` `DbCommand`s to be
disabled so they won't have a Span created from them.

## Reason for change

Since we can instrument _any_ `DbCommand` in `ADO.NET` this can lead to
unwanted/duplicate Spans that customers have little control over. This
allows for a comma-separated list of command type names that the .NET
Tracer will not create a Span for if they encounter it.

## Implementation details

Adds new Environment Variable `DD_TRACE_DISABLED_ADONET_COMMAND_TYPES`
that accepts a comma-separated `string` of `ADO.NET` Command Type names
that the Tracer will not create a Span for.

For example (some pseudo-code here):

Assuming we have a custom `DbCommand` `FooDbCommand` that we don't want
Spans for ->

```csharp
public class FooDbCommand : DbCommand
{
    ... class contents here
}
```

We'd need to set `DD_TRACE_DISABLED_ADONET_COMMAND_TYPES` to ->

```
DD_TRACE_DISABLED_ADONET_COMMAND_TYPES="FooDbCommand"
```

## Test coverage

- Extended current `DbScopeFactoryTests` to add new value.
- Extended `FakeCommandTests` to include disabling of `FakeCommand`
- Snapshotted those tests as well.

## Other details

Merge the dd-go PR when this PR is merged:
DataDog/dd-go#150493

Backport of #6042
<!-- Fixes #{issue} -->

<!-- ⚠️ Note: where possible, please obtain 2 approvals prior to
merging. Unless CODEOWNERS specifies otherwise, for external teams it is
typically best to have one review from a team member, and one review
from apm-dotnet. Trivial changes do not require 2 reviews. -->

---------

Co-authored-by: Lucas Pimentel <[email protected]>
@bouwkast bouwkast merged commit 801f63a into master Oct 21, 2024
76 checks passed
@bouwkast bouwkast deleted the steven/29781 branch October 21, 2024 20:52
@github-actions github-actions bot added this to the vNext-v3 milestone Oct 21, 2024
@andrewlock andrewlock added the area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) label Oct 23, 2024
@andrewlock andrewlock added type:new-feature area:automatic-instrumentation Automatic instrumentation managed C# code (Datadog.Trace.ClrProfiler.Managed) labels Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:automatic-instrumentation Automatic instrumentation managed C# code (Datadog.Trace.ClrProfiler.Managed) area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) type:new-feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants