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 ActivitySources from being listened to #5795

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

bouwkast
Copy link
Contributor

@bouwkast bouwkast commented Jul 19, 2024

Summary of changes

This adds the ability for ActivitySources to be disabled so that they won't be listened to by the .NET Tracer.

Reason for change

Currently there is no way to disable an ActivitySource if OpenTelemetry is enabled in the .NET Tracer without entirely disabling OpenTelemetry support. The IgnoreActivityHandler is insufficient as it will still listen to the ActivitySource so they will create Activity objects.

Implementation details

  • Adds DD_TRACE_DISABLED_ACTIVITY_SOURCES that accepts a comma-separated list of ActivitySource names that supports the glob-pattern.
    • example: "DD_TRACE_DISABLED_ACTIVITY_SOURCES": "SomeSourceName,*SomeGlobPattern*"
  • Adds DisableActivityHandler that will determine based on the above environment variable whether or not a given ActivitySource should be listened to.

Test coverage

  • Updated the NetActivitySdk sample project with an ignored ActivitySource and some that are disabled.

Other details

When merged, get this merged: https://github.com/DataDog/dd-go/pull/148984

Fixes #5740

@github-actions github-actions bot added the area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) label Jul 19, 2024
@andrewlock
Copy link
Member

andrewlock commented Jul 19, 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 (5795) - mean (70ms)  : 68, 73
     .   : milestone, 70,
    master - mean (70ms)  : 67, 72
     .   : milestone, 70,

    section CallTarget+Inlining+NGEN
    This PR (5795) - mean (1,110ms)  : 1086, 1134
     .   : milestone, 1110,
    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 (5795) - mean (108ms)  : 104, 113
     .   : milestone, 108,
    master - mean (109ms)  : 105, 112
     .   : milestone, 109,

    section CallTarget+Inlining+NGEN
    This PR (5795) - mean (767ms)  : 755, 779
     .   : milestone, 767,
    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 (5795) - mean (92ms)  : 90, 94
     .   : milestone, 92,
    master - mean (92ms)  : 89, 95
     .   : milestone, 92,

    section CallTarget+Inlining+NGEN
    This PR (5795) - mean (722ms)  : 709, 735
     .   : milestone, 722,
    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 (5795) - mean (190ms)  : 186, 193
     .   : milestone, 190,
    master - mean (189ms)  : 186, 192
     .   : milestone, 189,

    section CallTarget+Inlining+NGEN
    This PR (5795) - mean (1,202ms)  : 1176, 1227
     .   : milestone, 1202,
    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 (5795) - mean (274ms)  : 269, 279
     .   : milestone, 274,
    master - mean (274ms)  : 269, 278
     .   : milestone, 274,

    section CallTarget+Inlining+NGEN
    This PR (5795) - mean (938ms)  : 918, 959
     .   : milestone, 938,
    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 (5795) - mean (264ms)  : 260, 268
     .   : milestone, 264,
    master - mean (263ms)  : 259, 267
     .   : milestone, 263,

    section CallTarget+Inlining+NGEN
    This PR (5795) - mean (926ms)  : 906, 946
     .   : milestone, 926,
    master - mean (924ms)  : 908, 940
     .   : milestone, 924,

Loading

@andrewlock
Copy link
Member

andrewlock commented Jul 19, 2024

Benchmarks Report for tracer 🐌

Benchmarks for #5795 compared to master:

  • 1 benchmarks are faster, with geometric mean 1.175
  • 1 benchmarks are slower, with geometric mean 1.181
  • 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
#5795 StartStopWithChild net6.0 7.9μs 44.4ns 304ns 0.0151 0.00756 0 5.43 KB
#5795 StartStopWithChild netcoreapp3.1 9.8μs 52.4ns 282ns 0.0187 0.00936 0 5.62 KB
#5795 StartStopWithChild net472 16.6μs 44.3ns 172ns 1.03 0.313 0.0989 6.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 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
#5795 WriteAndFlushEnrichedTraces net6.0 473μs 353ns 1.32μs 0 0 0 2.7 KB
#5795 WriteAndFlushEnrichedTraces netcoreapp3.1 644μs 792ns 2.96μs 0 0 0 2.7 KB
#5795 WriteAndFlushEnrichedTraces net472 843μs 936ns 3.5μs 0.417 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
#5795 SendRequest net6.0 197μs 1.09μs 6.53μs 0.22 0 0 18.45 KB
#5795 SendRequest netcoreapp3.1 226μs 1.13μs 4.8μs 0.225 0 0 20.61 KB
#5795 SendRequest net472 0.000744ns 0.00031ns 0.00112ns 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
#5795 WriteAndFlushEnrichedTraces net6.0 582μs 2.93μs 12.4μs 0.568 0 0 41.62 KB
#5795 WriteAndFlushEnrichedTraces netcoreapp3.1 698μs 3.32μs 14.1μs 0.343 0 0 41.82 KB
#5795 WriteAndFlushEnrichedTraces net472 904μs 3.49μs 13.1μs 8.19 2.59 0.431 53.33 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.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
#5795 ExecuteNonQuery net6.0 1.28μs 0.979ns 3.79ns 0.0141 0 0 1.02 KB
#5795 ExecuteNonQuery netcoreapp3.1 1.72μs 1.29ns 4.99ns 0.0138 0 0 1.02 KB
#5795 ExecuteNonQuery net472 2.09μs 2.58ns 9.66ns 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
#5795 CallElasticsearch net6.0 1.24μs 1.82ns 7.03ns 0.0137 0 0 976 B
#5795 CallElasticsearch netcoreapp3.1 1.59μs 1.35ns 5.06ns 0.0129 0 0 976 B
#5795 CallElasticsearch net472 2.42μs 1.52ns 5.9ns 0.158 0 0 995 B
#5795 CallElasticsearchAsync net6.0 1.32μs 1.37ns 5.13ns 0.0133 0 0 952 B
#5795 CallElasticsearchAsync netcoreapp3.1 1.57μs 0.895ns 3.35ns 0.0133 0 0 1.02 KB
#5795 CallElasticsearchAsync net472 2.62μs 1.83ns 7.08ns 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
#5795 ExecuteAsync net6.0 1.19μs 1.16ns 4.5ns 0.0131 0 0 952 B
#5795 ExecuteAsync netcoreapp3.1 1.56μs 0.639ns 2.39ns 0.0126 0 0 952 B
#5795 ExecuteAsync net472 1.7μs 1.2ns 4.5ns 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
#5795 SendAsync net6.0 4.2μs 0.986ns 3.56ns 0.0294 0 0 2.22 KB
#5795 SendAsync netcoreapp3.1 5.11μs 2.72ns 10.5ns 0.0363 0 0 2.76 KB
#5795 SendAsync net472 7.71μs 1.5ns 5.81ns 0.497 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
#5795 EnrichedLog net6.0 1.48μs 0.829ns 2.99ns 0.023 0 0 1.64 KB
#5795 EnrichedLog netcoreapp3.1 2.16μs 1.38ns 5.34ns 0.0217 0 0 1.64 KB
#5795 EnrichedLog net472 2.5μs 0.896ns 3.23ns 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
#5795 EnrichedLog net6.0 117μs 172ns 667ns 0.0581 0 0 4.28 KB
#5795 EnrichedLog netcoreapp3.1 122μs 134ns 519ns 0 0 0 4.28 KB
#5795 EnrichedLog net472 152μs 176ns 681ns 0.68 0.227 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
#5795 EnrichedLog net6.0 3.19μs 1.14ns 4.4ns 0.0305 0 0 2.2 KB
#5795 EnrichedLog netcoreapp3.1 4.28μs 1.74ns 6.75ns 0.0299 0 0 2.2 KB
#5795 EnrichedLog net472 4.85μs 1.39ns 5.2ns 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
#5795 SendReceive net6.0 1.39μs 0.365ns 1.37ns 0.0162 0 0 1.14 KB
#5795 SendReceive netcoreapp3.1 1.86μs 0.728ns 2.82ns 0.015 0 0 1.14 KB
#5795 SendReceive net472 2.08μs 0.896ns 3.35ns 0.183 0.00104 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
#5795 EnrichedLog net6.0 2.85μs 0.898ns 3.48ns 0.0213 0 0 1.6 KB
#5795 EnrichedLog netcoreapp3.1 4.05μs 2.77ns 10.7ns 0.0222 0 0 1.65 KB
#5795 EnrichedLog net472 4.25μs 1.54ns 5.75ns 0.324 0 0 2.04 KB
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #5795

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

Faster 🎉 in #5795

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

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
#5795 StartFinishSpan net6.0 408ns 0.141ns 0.548ns 0.00797 0 0 576 B
#5795 StartFinishSpan netcoreapp3.1 641ns 0.713ns 2.76ns 0.00789 0 0 576 B
#5795 StartFinishSpan net472 686ns 0.533ns 2.07ns 0.0918 0 0 578 B
#5795 StartFinishScope net6.0 564ns 0.219ns 0.818ns 0.0097 0 0 696 B
#5795 StartFinishScope netcoreapp3.1 733ns 0.418ns 1.62ns 0.00934 0 0 696 B
#5795 StartFinishScope net472 849ns 0.679ns 2.63ns 0.104 0 0 658 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 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
#5795 RunOnMethodBegin net6.0 601ns 0.256ns 0.992ns 0.00982 0 0 696 B
#5795 RunOnMethodBegin netcoreapp3.1 976ns 1.15ns 4.46ns 0.00929 0 0 696 B
#5795 RunOnMethodBegin net472 1.13μs 0.561ns 2.17ns 0.104 0 0 658 B

@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Jul 19, 2024

Datadog Report

Branch report: steven/disable-otel-integrations
Commit report: f4e4f36
Test service: dd-trace-dotnet

✅ 0 Failed, 362976 Passed, 2071 Skipped, 14h 55m 57.67s Total Time

@bouwkast bouwkast force-pushed the steven/disable-otel-integrations branch from 87fbe4e to eda5838 Compare August 16, 2024 22:55
@bouwkast bouwkast changed the title Add DisableActivityHandler for disabling ActivitySources Add ability to disable ActivitySources from being listened to Aug 16, 2024
@bouwkast bouwkast force-pushed the steven/disable-otel-integrations branch from eda5838 to df96756 Compare August 16, 2024 23:03
@bouwkast bouwkast marked this pull request as ready for review August 16, 2024 23:05
@bouwkast bouwkast requested a review from a team as a code owner August 16, 2024 23:05
@andrewlock
Copy link
Member

andrewlock commented Aug 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 (5795) (11.089M)   : 0, 11089168
    master (11.252M)   : 0, 11251784
    benchmarks/2.9.0 (11.081M)   : 0, 11080577

    section Automatic
    This PR (5795) (7.359M)   : 0, 7359058
    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 (5795) (6.826M)   : 0, 6826031
    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 (5795) (9.725M)   : 0, 9724710
    master (9.539M)   : 0, 9539093
    benchmarks/2.9.0 (9.798M)   : 0, 9798067

    section Automatic
    This PR (5795) (6.440M)   : 0, 6439529
    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 (5795) (6.293M)   : 0, 6292650
    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 (5795) (9.994M)   : 0, 9994176
    master (10.064M)   : 0, 10064242
    benchmarks/2.9.0 (10.067M)   : 0, 10067315

    section Automatic
    This PR (5795) (6.655M)   : 0, 6654718
    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 (5795) (6.140M)   : 0, 6139715
    master (6.348M)   : 0, 6347556

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

Loading

/// Default is empty (all ActivitySources will be subscribed to by default).
/// Supports multiple values separated with commas.
/// </summary>
public const string DisabledActivitySources = "DD_DISABLED_ACTIVITY_SOURCES";
Copy link
Member

Choose a reason for hiding this comment

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

We probably want to use the standard DD_TRACE_ prefix here.

(Don't follow DD_DISABLED_INTEGRATIONS above: that's a very old setting from before we had naming conventions. 😅)

Suggested change
public const string DisabledActivitySources = "DD_DISABLED_ACTIVITY_SOURCES";
public const string DisabledActivitySources = "DD_TRACE_DISABLED_ACTIVITY_SOURCES";

Copy link
Member

Choose a reason for hiding this comment

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

Don't forget to add this to the configuration telemetry intake's allow-list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://github.com/DataDog/dd-go/pull/148984

Thanks! Changed the name and made that PR (draft at the moment)

Sorry, I didn't accept your suggestion, got carried away locally :)

Copy link
Member

@lucaspimentel lucaspimentel left a comment

Choose a reason for hiding this comment

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

LGTM aside from the setting name.

@lucaspimentel lucaspimentel requested a review from a team August 20, 2024 19:05
@bouwkast bouwkast force-pushed the steven/disable-otel-integrations branch from df96756 to e958ed5 Compare September 5, 2024 19:08
@lucaspimentel lucaspimentel requested a review from a team September 5, 2024 19:41
This allows for users to pass in a comma separated
list of Activity Source names (glob-pattern supported)
that should not be listened to by the Datadog Tracer.
@bouwkast bouwkast force-pushed the steven/disable-otel-integrations branch from c1eafd0 to f4e4f36 Compare October 11, 2024 18:17
Copy link
Member

@andrewlock andrewlock left a comment

Choose a reason for hiding this comment

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

LGTM, just a couple of minor suggestions/questions

{
Log.Debug("ActivityListenerHandler: {SourceName} will be handled by {Handler}.", sName, handler);
return true;
if (handler is DisableActivityHandler)
Copy link
Member

Choose a reason for hiding this comment

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

Rather than checking the type of the handler here, I wonder if it makes more sense to change the return from ShouldListenTo to be an enum instead e.g. something like this (I hate all of these names though!)

public enum ListenState
{
    Listen,
    Skip, // don't listen, but allow something else to listen
    Deny, // don't listen, don't allow anything else to listen
}

Comment on lines +12 to +13
// Disable Activity Handler does not listen to the activity source at all.
internal static readonly DisableActivityHandler DisableHandler = new();
Copy link
Member

Choose a reason for hiding this comment

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

Is there any value in having a separate DisableActivityHandler vs IgnoreActivityHandler 🤔 Given that the IgnoreActivityHandler causes behaviour changes that it sounds like we don't want, would it make sense to replace IgnoreActivityHandler?

i.e. should we allow people to disable handlers, but also change all our existing "ignored" handlers to be disabled? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So for the "Ignored" Activities we do go and update them for context propagation so they are ignored in the sense that we don't create a Datadog span for them, but we still do need to do things as we listen to the source. I think we want to keep that.

The "Disabled" toggles that listener off so we don't know anything about them.

Copy link
Member

Choose a reason for hiding this comment

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

OK, cool, then I guess my question is: what are the implications if someone disables an activity that's in the "middle" of the trace? What about if it's a "root" activity? Will that mess up our tracing, or will we just have a gap (which is fine) but everything else in terms or parenting etc would work ok? I guess that's somewhat covered by the tests, but it's not entirely clear to me

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those are good questions

I haven't really looked at this stuff in a long time so I don't know off the top of my head, but I will add test cases to the sample project to test this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to completely disable Npgsql tracing
3 participants