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

Fix bugs with DogStatsD when using named pipes or UDS #4933

Merged
merged 6 commits into from
Dec 1, 2023

Conversation

andrewlock
Copy link
Member

@andrewlock andrewlock commented Nov 28, 2023

Summary of changes

  • Explicitly pass in the calculated pipename to StatsD when using named pipes
  • Correctly fallback when using UDS for traces and UDP for metrics
  • Add tests for StatsDService creation

Reason for change

If there's no PipeName set, no ServerName set, and no environment variables set, StatsD throws an ArgumentNullException

Similarly, if DD_TRACE_AGENT_URL is set to a unix:// path, and the metrics socket is not in the default location, stats falls back to UDP, but we then currently fail to create the StatsDService.

Implementation details

  • Explicitly pass the named pipe through the config.
  • Add workaround for UDS/UDP combo by checking for an empty host
  • Added an [EnvironmentRestorer] attribute for use in testing to make it easier to clear and restore env vars

Test coverage

Happy path is already covered by named pipe tests - the specific error is hard to reproduce with current infrastructure.

For the UDS/UDP combo, reproduced in unit tests, which are now passing after the fix

Other details

These errors may well be coming from lib-injection which appears to use /opt/datadog/apm/inject/run/dsd.socket for metrics rather than the expected /var/run/datadog/dsd.socket

@andrewlock andrewlock requested a review from a team as a code owner November 28, 2023 12:58
@github-actions github-actions bot added the area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) label Nov 28, 2023
Comment on lines -299 to -301
// Environment variables for windows named pipes are not explicitly passed to statsd.
// They are retrieved within the vendored code, so there is nothing to pass.
// Passing anything through StatsdConfig may cause bugs when windows named pipes should be used.
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a pretty old comment, which I think is incorrect now. We don't want statsd to grab the values directly from the environment, because

  • It may not have permission too, so it's unsafe
  • We may have a "better" pipename to pass to it via config etc

I suspect this comment only applied to a previous version than the currently vendored one

@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Nov 28, 2023

Datadog Report

Branch report: andrew/fix-statsdconfig
Commit report: 5a5924f

❄️ dd-trace-dotnet: 0 Failed, 1 New Flaky, 302842 Passed, 994 Skipped, 1 Regression, 40m 54.8s Wall Time

New Flaky Tests (1)

  • ManualOnly - Datadog.Trace.ClrProfiler.IntegrationTests.ManualInstrumentationTests - Last Failure

    Expand for error
     Results do not match.
     Differences:
     Received: ManualInstrumentationTests.ManualOnly.received.txt
     Verified: ManualInstrumentationTests.ManualOnly.verified.txt
     Received Content:
     [
       {
         TraceId: Id_1,
         SpanId: Id_2,
         Name: Manual-1.Initial,
     ...
    

⌛ Performance Regressions vs Default Branch (1)

  • Profiler_liveheap_cpu_walltime - scenarios 4.65s (+222.83ms, +5%) - Details

@andrewlock
Copy link
Member Author

andrewlock commented Nov 28, 2023

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 (4933) - mean (71ms)  : 64, 79
     .   : milestone, 71,
    master - mean (69ms)  : 63, 75
     .   : milestone, 69,

    section CallTarget+Inlining+NGEN
    This PR (4933) - mean (1,006ms)  : 981, 1031
     .   : milestone, 1006,
    master - mean (1,002ms)  : 979, 1024
     .   : milestone, 1002,

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

    section CallTarget+Inlining+NGEN
    This PR (4933) - mean (693ms)  : 675, 710
     .   : milestone, 693,
    master - mean (687ms)  : 675, 698
     .   : milestone, 687,

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

    section CallTarget+Inlining+NGEN
    This PR (4933) - mean (658ms)  : 636, 681
     .   : milestone, 658,
    master - mean (659ms)  : 638, 681
     .   : milestone, 659,

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

    section CallTarget+Inlining+NGEN
    This PR (4933) - mean (1,134ms)  : 1115, 1152
     .   : milestone, 1134,
    master - mean (1,132ms)  : 1111, 1153
     .   : milestone, 1132,

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

    section CallTarget+Inlining+NGEN
    This PR (4933) - mean (1,086ms)  : 1062, 1109
     .   : milestone, 1086,
    master - mean (1,087ms)  : 1057, 1117
     .   : milestone, 1087,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4933) - mean (262ms)  : 259, 265
     .   : milestone, 262,
    master - mean (262ms)  : 257, 266
     .   : milestone, 262,

    section CallTarget+Inlining+NGEN
    This PR (4933) - mean (1,055ms)  : 1033, 1076
     .   : milestone, 1055,
    master - mean (1,059ms)  : 1035, 1083
     .   : milestone, 1059,

Loading

@andrewlock
Copy link
Member Author

andrewlock commented Nov 28, 2023

Benchmarks Report 🐌

Benchmarks for #4933 compared to master:

  • 3 benchmarks are faster, with geometric mean 1.202
  • 1 benchmarks are slower, with geometric mean 1.214
  • 1 benchmarks have fewer 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.61μs 48.8ns 331ns 0.0303 0.013 0 7.48 KB
master StartStopWithChild netcoreapp3.1 10.6μs 59.3ns 365ns 0.0319 0.0106 0 7.57 KB
master StartStopWithChild net472 17.1μs 47.2ns 183ns 1.36 0.382 0.136 7.96 KB
#4933 StartStopWithChild net6.0 8.81μs 48.9ns 320ns 0.0173 0.00867 0 7.48 KB
#4933 StartStopWithChild netcoreapp3.1 10.5μs 57ns 312ns 0.0208 0.0104 0 7.58 KB
#4933 StartStopWithChild net472 17.3μs 41.8ns 156ns 1.34 0.363 0.112 7.96 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 467μs 339ns 1.31μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 639μs 274ns 1.06μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 788μs 451ns 1.75μs 0.393 0 0 3.3 KB
#4933 WriteAndFlushEnrichedTraces net6.0 459μs 311ns 1.2μs 0 0 0 2.7 KB
#4933 WriteAndFlushEnrichedTraces netcoreapp3.1 643μs 287ns 1.08μs 0 0 0 2.7 KB
#4933 WriteAndFlushEnrichedTraces net472 782μs 480ns 1.73μs 0.388 0 0 3.3 KB
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #4933

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody‑net472 1.214 3,390.77 4,116.18

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 43.5μs 24.2ns 90.5ns 0.0218 0 0 1.77 KB
master AllCycleSimpleBody netcoreapp3.1 47.7μs 37.7ns 141ns 0 0 0 1.74 KB
master AllCycleSimpleBody net472 49.4μs 24.8ns 96.1ns 0.27 0 0 1.81 KB
master AllCycleMoreComplexBody net6.0 212μs 84.4ns 327ns 0.106 0 0 9.25 KB
master AllCycleMoreComplexBody netcoreapp3.1 228μs 198ns 768ns 0.112 0 0 9.14 KB
master AllCycleMoreComplexBody net472 237μs 117ns 452ns 1.42 0 0 9.32 KB
master ObjectExtractorSimpleBody net6.0 130ns 0.129ns 0.465ns 0.00392 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 188ns 0.182ns 0.705ns 0.00377 0 0 272 B
master ObjectExtractorSimpleBody net472 153ns 0.0573ns 0.214ns 0.0446 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 2.74μs 1.38ns 5.33ns 0.0534 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 3.83μs 1.15ns 4.47ns 0.0498 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 3.39μs 1.03ns 3.73ns 0.602 0.0051 0 3.8 KB
#4933 AllCycleSimpleBody net6.0 44.6μs 139ns 539ns 0.022 0 0 1.77 KB
#4933 AllCycleSimpleBody netcoreapp3.1 46.8μs 66.8ns 259ns 0.0233 0 0 1.74 KB
#4933 AllCycleSimpleBody net472 50.1μs 27.1ns 105ns 0.274 0 0 1.81 KB
#4933 AllCycleMoreComplexBody net6.0 212μs 80.3ns 290ns 0.106 0 0 9.25 KB
#4933 AllCycleMoreComplexBody netcoreapp3.1 225μs 251ns 939ns 0.112 0 0 9.14 KB
#4933 AllCycleMoreComplexBody net472 239μs 60.3ns 217ns 1.42 0 0 9.32 KB
#4933 ObjectExtractorSimpleBody net6.0 133ns 0.0428ns 0.16ns 0.00396 0 0 280 B
#4933 ObjectExtractorSimpleBody netcoreapp3.1 185ns 0.113ns 0.425ns 0.00372 0 0 272 B
#4933 ObjectExtractorSimpleBody net472 152ns 0.13ns 0.503ns 0.0446 0 0 281 B
#4933 ObjectExtractorMoreComplexBody net6.0 2.95μs 2.07ns 7.75ns 0.0531 0 0 3.78 KB
#4933 ObjectExtractorMoreComplexBody netcoreapp3.1 3.56μs 1.04ns 3.89ns 0.0498 0 0 3.69 KB
#4933 ObjectExtractorMoreComplexBody net472 4.12μs 3.41ns 13.2ns 0.601 0.00618 0 3.8 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 RunWaf(args=NestedMap (10)) net6.0 51.8μs 266ns 1.27μs 0.217 0 0 16.06 KB
master RunWaf(args=NestedMap (10)) netcoreapp3.1 65.4μs 231ns 802ns 0.193 0 0 16.06 KB
master RunWaf(args=NestedMap (10)) net472 97.7μs 490ns 2.08μs 2.52 0.0934 0 16.14 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 122μs 631ns 3.22μs 0.289 0 0 22.41 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 141μs 283ns 1.09μs 0.269 0 0 22.36 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net472 171μs 851ns 3.71μs 3.56 0.166 0 22.7 KB
master RunWaf(args=NestedMap (100)) net6.0 102μs 595ns 5.26μs 0.458 0 0 32.76 KB
master RunWaf(args=NestedMap (100)) netcoreapp3.1 132μs 336ns 1.3μs 0.395 0 0 33.33 KB
master RunWaf(args=NestedMap (100)) net472 190μs 65.9ns 255ns 5.3 0.365 0 33.67 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) net6.0 170μs 925ns 5.31μs 0.484 0 0 39.1 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) netcoreapp3.1 205μs 957ns 3.71μs 0.508 0 0 39.63 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) net472 270μs 224ns 869ns 6.38 0.521 0 40.23 KB
master RunWaf(args=NestedMap (20)) net6.0 106μs 40.6ns 157ns 0.422 0 0 32.18 KB
master RunWaf(args=NestedMap (20)) netcoreapp3.1 133μs 277ns 1.07μs 0.381 0 0 32.3 KB
master RunWaf(args=NestedMap (20)) net472 182μs 105ns 406ns 5.1 0.364 0 32.63 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 168μs 59.2ns 222ns 0.497 0 0 38.53 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 210μs 186ns 719ns 0.528 0 0 38.6 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net472 262μs 122ns 457ns 6.21 0.518 0 39.2 KB
#4933 RunWaf(args=NestedMap (10)) net6.0 52.6μs 279ns 1.48μs 0.207 0 0 16.06 KB
#4933 RunWaf(args=NestedMap (10)) netcoreapp3.1 64.7μs 232ns 869ns 0.199 0 0 16.06 KB
#4933 RunWaf(args=NestedMap (10)) net472 94.2μs 48.7ns 182ns 2.53 0.0936 0 16.14 KB
#4933 RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 112μs 49.8ns 193ns 0.282 0 0 22.41 KB
#4933 RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 134μs 697ns 3.42μs 0.274 0 0 22.36 KB
#4933 RunWafWithAttack(args=Neste(...)tack) [22]) net472 165μs 121ns 452ns 3.54 0.164 0 22.7 KB
#4933 RunWaf(args=NestedMap (100)) net6.0 105μs 593ns 4.44μs 0.427 0 0 32.76 KB
#4933 RunWaf(args=NestedMap (100)) netcoreapp3.1 132μs 715ns 3.92μs 0.436 0 0 33.33 KB
#4933 RunWaf(args=NestedMap (100)) net472 184μs 131ns 471ns 5.32 0.367 0 33.67 KB
#4933 RunWafWithAttack(args=Neste(...)tack) [23]) net6.0 176μs 90.8ns 352ns 0.523 0 0 39.1 KB
#4933 RunWafWithAttack(args=Neste(...)tack) [23]) netcoreapp3.1 202μs 758ns 2.84μs 0.501 0 0 39.63 KB
#4933 RunWafWithAttack(args=Neste(...)tack) [23]) net472 258μs 279ns 968ns 6.28 0.512 0 40.23 KB
#4933 RunWaf(args=NestedMap (20)) net6.0 98.8μs 32.7ns 118ns 0.4 0 0 32.18 KB
#4933 RunWaf(args=NestedMap (20)) netcoreapp3.1 131μs 123ns 443ns 0.434 0 0 32.3 KB
#4933 RunWaf(args=NestedMap (20)) net472 181μs 89.6ns 347ns 5.16 0.362 0 32.63 KB
#4933 RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 162μs 51.4ns 199ns 0.487 0 0 38.53 KB
#4933 RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 204μs 705ns 2.73μs 0.496 0 0 38.6 KB
#4933 RunWafWithAttack(args=Neste(...)tack) [22]) net472 258μs 141ns 526ns 6.19 0.515 0 39.2 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 158ns 546ns 0.17 0 0 18.25 KB
master SendRequest netcoreapp3.1 193μs 247ns 956ns 0.192 0 0 20.41 KB
master SendRequest net472 0ns 0ns 0ns 0 0 0 0 b
#4933 SendRequest net6.0 175μs 196ns 759ns 0.175 0 0 18.25 KB
#4933 SendRequest netcoreapp3.1 195μs 362ns 1.4μs 0.195 0 0 20.41 KB
#4933 SendRequest net472 0.000334ns 0.000185ns 0.000716ns 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 548μs 403ns 1.56μs 0.561 0 0 41.72 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 653μs 725ns 2.71μs 0.331 0 0 41.79 KB
master WriteAndFlushEnrichedTraces net472 803μs 3μs 11.2μs 8.41 2.4 0.401 53.21 KB
#4933 WriteAndFlushEnrichedTraces net6.0 545μs 1.26μs 4.89μs 0.539 0 0 41.81 KB
#4933 WriteAndFlushEnrichedTraces netcoreapp3.1 677μs 963ns 3.73μs 0.331 0 0 41.63 KB
#4933 WriteAndFlushEnrichedTraces net472 826μs 4.09μs 18.3μs 8.22 2.47 0.411 53.22 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.09μs 0.906ns 3.51ns 0.011 0 0 768 B
master ExecuteNonQuery netcoreapp3.1 1.44μs 0.347ns 1.34ns 0.0102 0 0 768 B
master ExecuteNonQuery net472 1.72μs 0.676ns 2.44ns 0.116 0.000853 0 730 B
#4933 ExecuteNonQuery net6.0 1.18μs 0.731ns 2.83ns 0.0106 0 0 768 B
#4933 ExecuteNonQuery netcoreapp3.1 1.48μs 0.974ns 3.37ns 0.00968 0 0 768 B
#4933 ExecuteNonQuery net472 1.78μs 2.08ns 7.77ns 0.116 0 0 730 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.13μs 1.12ns 4.19ns 0.0131 0 0 936 B
master CallElasticsearch netcoreapp3.1 1.5μs 0.587ns 2.2ns 0.0122 0 0 936 B
master CallElasticsearch net472 2.49μs 0.929ns 3.6ns 0.151 0.00124 0 955 B
master CallElasticsearchAsync net6.0 1.26μs 0.571ns 2.21ns 0.0126 0 0 912 B
master CallElasticsearchAsync netcoreapp3.1 1.66μs 1.58ns 6.13ns 0.0134 0 0 984 B
master CallElasticsearchAsync net472 2.57μs 0.653ns 2.35ns 0.159 0 0 1.01 KB
#4933 CallElasticsearch net6.0 1.17μs 0.651ns 2.44ns 0.013 0 0 936 B
#4933 CallElasticsearch netcoreapp3.1 1.56μs 0.812ns 3.14ns 0.0125 0 0 936 B
#4933 CallElasticsearch net472 2.54μs 0.516ns 1.86ns 0.151 0 0 955 B
#4933 CallElasticsearchAsync net6.0 1.34μs 0.364ns 1.36ns 0.0128 0 0 912 B
#4933 CallElasticsearchAsync netcoreapp3.1 1.61μs 3.19ns 11.9ns 0.013 0 0 984 B
#4933 CallElasticsearchAsync net472 2.6μs 1.27ns 4.92ns 0.16 0 0 1.01 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.33μs 0.914ns 3.54ns 0.0125 0 0 912 B
master ExecuteAsync netcoreapp3.1 1.61μs 0.661ns 2.47ns 0.0121 0 0 912 B
master ExecuteAsync net472 1.78μs 1.06ns 3.98ns 0.138 0.000887 0 875 B
#4933 ExecuteAsync net6.0 1.23μs 1.12ns 4.34ns 0.0131 0 0 912 B
#4933 ExecuteAsync netcoreapp3.1 1.55μs 0.667ns 2.49ns 0.0124 0 0 912 B
#4933 ExecuteAsync net472 1.8μs 1.02ns 3.93ns 0.139 0.0009 0 875 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.08μs 2.18ns 8.16ns 0.0286 0 0 2.1 KB
master SendAsync netcoreapp3.1 4.95μs 2.59ns 10ns 0.0345 0 0 2.63 KB
master SendAsync net472 7.8μs 2.53ns 9.47ns 0.523 0 0 3.31 KB
#4933 SendAsync net6.0 4.03μs 1.61ns 6.22ns 0.0284 0 0 2.1 KB
#4933 SendAsync netcoreapp3.1 5.05μs 1.88ns 7.3ns 0.0353 0 0 2.63 KB
#4933 SendAsync net472 7.79μs 3.02ns 11.7ns 0.525 0 0 3.31 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Faster 🎉 Fewer allocations 🎉

Faster 🎉 in #4933

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark(parameters: System.Collections.Generic.List`1[System.String])‑netcoreapp3.1 1.173 61,800.00 52,700.00 multimodal

Fewer allocations 🎉 in #4933

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark(parameters: System.Collections.Generic.List`1[System.String])‑net472 65.54 KB 57.34 KB -8.19 KB -12.50%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark(parameters=Syste(...)ring] [48]) net6.0 54.4μs 269ns 1.11μs 0 0 0 43.44 KB
master StringConcatBenchmark(parameters=Syste(...)ring] [48]) netcoreapp3.1 62.3μs 748ns 7.44μs 0 0 0 42.64 KB
master StringConcatBenchmark(parameters=Syste(...)ring] [48]) net472 37.7μs 116ns 419ns 0 0 0 59.77 KB
master StringConcatAspectBenchmark(parameters=Syste(...)ring] [48]) net6.0 65.2μs 288ns 1.08μs 0 0 0 43.29 KB
master StringConcatAspectBenchmark(parameters=Syste(...)ring] [48]) netcoreapp3.1 107μs 3.6μs 35.6μs 0 0 0 42.64 KB
master StringConcatAspectBenchmark(parameters=Syste(...)ring] [48]) net472 56.6μs 781ns 7.77μs 0 0 0 65.54 KB
#4933 StringConcatBenchmark(parameters=Syste(...)ring] [48]) net6.0 52.2μs 270ns 1.27μs 0 0 0 43.44 KB
#4933 StringConcatBenchmark(parameters=Syste(...)ring] [48]) netcoreapp3.1 53μs 275ns 1.26μs 0 0 0 42.64 KB
#4933 StringConcatBenchmark(parameters=Syste(...)ring] [48]) net472 37.9μs 177ns 771ns 0 0 0 59.81 KB
#4933 StringConcatAspectBenchmark(parameters=Syste(...)ring] [48]) net6.0 65.9μs 317ns 1.34μs 0 0 0 43.29 KB
#4933 StringConcatAspectBenchmark(parameters=Syste(...)ring] [48]) netcoreapp3.1 97.6μs 3.2μs 31.7μs 0 0 0 42.64 KB
#4933 StringConcatAspectBenchmark(parameters=Syste(...)ring] [48]) net472 65.8μs 258ns 997ns 0 0 0 57.34 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.43μs 1.17ns 4.39ns 0.0223 0 0 1.57 KB
master EnrichedLog netcoreapp3.1 2.21μs 0.758ns 2.94ns 0.0213 0 0 1.57 KB
master EnrichedLog net472 2.47μs 2.08ns 8.04ns 0.237 0 0 1.5 KB
#4933 EnrichedLog net6.0 1.45μs 0.397ns 1.49ns 0.022 0 0 1.57 KB
#4933 EnrichedLog netcoreapp3.1 2.2μs 5.68ns 22ns 0.0215 0 0 1.57 KB
#4933 EnrichedLog net472 2.61μs 2.02ns 7.81ns 0.238 0 0 1.5 KB
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 114μs 208ns 804ns 0.0573 0 0 4.21 KB
master EnrichedLog netcoreapp3.1 119μs 373ns 1.45μs 0 0 0 4.21 KB
master EnrichedLog net472 147μs 129ns 500ns 0.663 0.221 0 4.39 KB
#4933 EnrichedLog net6.0 112μs 111ns 429ns 0 0 0 4.21 KB
#4933 EnrichedLog netcoreapp3.1 118μs 171ns 639ns 0 0 0 4.21 KB
#4933 EnrichedLog net472 150μs 120ns 463ns 0.676 0.225 0 4.39 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 2.98μs 0.976ns 3.78ns 0.0296 0 0 2.13 KB
master EnrichedLog netcoreapp3.1 4.24μs 1.46ns 5.46ns 0.0276 0 0 2.13 KB
master EnrichedLog net472 4.89μs 3.46ns 13.4ns 0.308 0 0 1.95 KB
#4933 EnrichedLog net6.0 2.97μs 1.23ns 4.44ns 0.0297 0 0 2.13 KB
#4933 EnrichedLog netcoreapp3.1 4.14μs 1.32ns 5.13ns 0.0289 0 0 2.13 KB
#4933 EnrichedLog net472 4.88μs 4.19ns 16.2ns 0.307 0 0 1.95 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.28μs 0.58ns 2.17ns 0.0155 0 0 1.1 KB
master SendReceive netcoreapp3.1 1.79μs 0.978ns 3.66ns 0.0152 0 0 1.1 KB
master SendReceive net472 2.2μs 1.92ns 7.45ns 0.176 0 0 1.12 KB
#4933 SendReceive net6.0 1.3μs 0.559ns 2.02ns 0.0157 0 0 1.1 KB
#4933 SendReceive netcoreapp3.1 1.7μs 0.882ns 3.42ns 0.0144 0 0 1.1 KB
#4933 SendReceive net472 2.16μs 1.97ns 7.62ns 0.177 0 0 1.12 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.63μs 1.07ns 4.01ns 0.0213 0 0 1.53 KB
master EnrichedLog netcoreapp3.1 3.81μs 1.48ns 5.54ns 0.0211 0 0 1.58 KB
master EnrichedLog net472 4.31μs 1.28ns 4.95ns 0.311 0 0 1.97 KB
#4933 EnrichedLog net6.0 2.69μs 1.44ns 5.4ns 0.0204 0 0 1.53 KB
#4933 EnrichedLog netcoreapp3.1 3.75μs 2.17ns 8.41ns 0.0206 0 0 1.58 KB
#4933 EnrichedLog net472 4.27μs 6.11ns 23.6ns 0.311 0 0 1.97 KB
Benchmarks.Trace.SpanBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #4933

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 1.226 636.80 519.24

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 448ns 0.114ns 0.442ns 0.00745 0 0 536 B
master StartFinishSpan netcoreapp3.1 689ns 0.353ns 1.37ns 0.00722 0 0 536 B
master StartFinishSpan net472 718ns 0.817ns 3.06ns 0.0853 0 0 538 B
master StartFinishScope net6.0 644ns 3.26ns 14.2ns 0.00903 0 0 656 B
master StartFinishScope netcoreapp3.1 945ns 0.469ns 1.82ns 0.00878 0 0 656 B
master StartFinishScope net472 1.01μs 1.08ns 4.2ns 0.0978 0 0 618 B
#4933 StartFinishSpan net6.0 471ns 2.24ns 8.97ns 0.00763 0 0 536 B
#4933 StartFinishSpan netcoreapp3.1 742ns 0.263ns 1.02ns 0.00732 0 0 536 B
#4933 StartFinishSpan net472 713ns 0.196ns 0.759ns 0.0854 0 0 538 B
#4933 StartFinishScope net6.0 519ns 0.378ns 1.46ns 0.00915 0 0 656 B
#4933 StartFinishScope netcoreapp3.1 917ns 0.217ns 0.839ns 0.00875 0 0 656 B
#4933 StartFinishScope net472 956ns 1.06ns 4.12ns 0.0981 0 0 618 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #4933

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 1.209 751.51 621.67

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 752ns 0.349ns 1.35ns 0.00905 0 0 656 B
master RunOnMethodBegin netcoreapp3.1 968ns 0.884ns 3.42ns 0.00882 0 0 656 B
master RunOnMethodBegin net472 1.03μs 0.258ns 0.929ns 0.0978 0 0 618 B
#4933 RunOnMethodBegin net6.0 622ns 0.154ns 0.595ns 0.00907 0 0 656 B
#4933 RunOnMethodBegin netcoreapp3.1 967ns 0.419ns 1.62ns 0.00911 0 0 656 B
#4933 RunOnMethodBegin net472 1.12μs 0.263ns 1.02ns 0.098 0 0 618 B

Copy link
Contributor

@bouwkast bouwkast left a comment

Choose a reason for hiding this comment

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

Looks good to me, just want to double check if we need to see if MetricsPipeNameInternal has a value first

@andrewlock
Copy link
Member Author

andrewlock commented Nov 29, 2023

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 (4933) (10.935M)   : 0, 10935134
    master (10.843M)   : 0, 10842955
    benchmarks/2.9.0 (10.902M)   : 0, 10901856

    section Automatic
    This PR (4933) (7.670M)   : 0, 7669617
    master (7.717M)   : 0, 7717296
    benchmarks/2.9.0 (7.812M)   : 0, 7812244

    section Trace stats
    This PR (4933) (8.092M)   : 0, 8091913
    master (7.987M)   : 0, 7986898

    section Manual
    This PR (4933) (9.912M)   : 0, 9911554
    master (9.641M)   : 0, 9641442

    section Manual + Automatic
    This PR (4933) (7.213M)   : 0, 7212599
    master (7.226M)   : 0, 7226484

    section Version Conflict
    This PR (4933) (6.355M)   : 0, 6355156
    master (6.403M)   : 0, 6403123

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (4933) (9.510M)   : 0, 9509711
    master (9.713M)   : 0, 9712994
    benchmarks/2.9.0 (9.771M)   : 0, 9771450

    section Automatic
    This PR (4933) (6.663M)   : 0, 6662872
    master (6.607M)   : 0, 6606537

    section Trace stats
    This PR (4933) (6.994M)   : 0, 6994071
    master (6.888M)   : 0, 6887932

    section Manual
    This PR (4933) (8.025M)   : 0, 8025253
    master (8.221M)   : 0, 8220805

    section Manual + Automatic
    This PR (4933) (6.242M)   : 0, 6241852
    master (6.003M)   : 0, 6003182

    section Version Conflict
    This PR (4933) (5.705M)   : 0, 5704990
    master (5.548M)   : 0, 5548209

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (4933) (10.474M)   : 0, 10474084
    master (10.099M)   : 0, 10099485
    benchmarks/2.9.0 (10.877M)   : 0, 10876503

    section Automatic
    This PR (4933) (7.307M)   : 0, 7306629
    master (7.366M)   : 0, 7366129
    benchmarks/2.9.0 (8.110M)   : 0, 8109662

    section Trace stats
    This PR (4933) (7.722M)   : 0, 7722195
    master (7.755M)   : 0, 7755352

    section Manual
    This PR (4933) (9.194M)   : 0, 9193513
    master (9.088M)   : 0, 9088139

    section Manual + Automatic
    This PR (4933) (7.171M)   : 0, 7171075
    master (6.936M)   : 0, 6936402

    section Version Conflict
    This PR (4933) (6.325M)   : 0, 6325003
    master (6.126M)   : 0, 6125533

Loading
gantt
    title Throughput Linux x64 (ASM) (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    master (7.591M)   : 0, 7590892
    benchmarks/2.9.0 (7.803M)   : 0, 7803140

    section No attack
    master (2.014M)   : 0, 2013599
    benchmarks/2.9.0 (3.216M)   : 0, 3215869

    section Attack
    master (1.625M)   : 0, 1624581
    benchmarks/2.9.0 (2.464M)   : 0, 2463754

    section Blocking
    master (3.393M)   : 0, 3393406

    section IAST default
    master (6.693M)   : 0, 6692725

    section IAST full
    master (5.723M)   : 0, 5722791

    section Base vuln
    master (0.922M)   : 0, 922289

    section IAST vuln
    master (0.891M)   : 0, 891407

Loading

@andrewlock andrewlock changed the title Explicitly set the pipename when using named pipes with dogstatsd Fix bugs with DogStatsD when using named pipes or UDS Nov 30, 2023
@andrewlock andrewlock merged commit 7373886 into master Dec 1, 2023
52 of 54 checks passed
@andrewlock andrewlock deleted the andrew/fix-statsdconfig branch December 1, 2023 17:13
@github-actions github-actions bot added this to the vNext milestone Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:runtime-metrics area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) type:bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants