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

Set default batch interval in serverless scenarios #4946

Merged
merged 2 commits into from
Dec 1, 2023

Conversation

andrewlock
Copy link
Member

Summary of changes

Sets the default DD_TRACE_BATCH_INTERVAL to 0 in lambda/gcp

Reason for change

Without this value, the lambda integration can give increased execution times

Implementation details

Change the default based on whether we're running in lambda

Test coverage

N/A

Other details

@andrewlock andrewlock requested a review from a team as a code owner December 1, 2023 13:02
@andrewlock andrewlock added the area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) label Dec 1, 2023
// If Lambda/GCP we don't wanat to have a flush interval. The serverless integration
// manually calls flush and waits for the result before ending execution.
// This can artificially increase the execution time of functions
var defaultTraceBatchInterval = IsRunningInLambda || IsRunningInGCPFunctions ? 0 : 100;
Copy link
Collaborator

@pierotibou pierotibou Dec 1, 2023

Choose a reason for hiding this comment

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

why don't you include AzureFunctionsConsumptionsPlan? I know it's not used yet (same for GCPFunctions btw), but It's what you've done for telemetry so I assume it could be relevant here as well no?
Edit: And thanks for doing the change btw

Copy link
Member Author

Choose a reason for hiding this comment

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

Tbh, because AzureFunctions works quite differently in general as I understand, the integration and the platform itself, so it didn't seem necessary. But I had forgot we detect this, so may as well I guess 🤷‍♂️

Copy link
Member Author

Choose a reason for hiding this comment

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

Done in 9e9644e

@andrewlock andrewlock force-pushed the andrew/default-flush-interval-in-serverless branch from 8b34c7f to 1db8b88 Compare December 1, 2023 13:18
@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Dec 1, 2023

Datadog Report

Branch report: andrew/default-flush-interval-in-serverless
Commit report: d46236f

dd-trace-dotnet: 0 Failed, 0 New Flaky, 304829 Passed, 955 Skipped, 29m 26.7s Wall Time

@andrewlock andrewlock force-pushed the andrew/default-flush-interval-in-serverless branch from 9e9644e to 139a2fb Compare December 1, 2023 14:02
@andrewlock andrewlock force-pushed the andrew/default-flush-interval-in-serverless branch from 139a2fb to d46236f Compare December 1, 2023 14:38
@andrewlock
Copy link
Member Author

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 (4946) - mean (72ms)  : 63, 81
     .   : milestone, 72,
    master - mean (70ms)  : 62, 77
     .   : milestone, 70,

    section CallTarget+Inlining+NGEN
    This PR (4946) - mean (998ms)  : 976, 1019
     .   : milestone, 998,
    master - mean (1,001ms)  : 986, 1017
     .   : milestone, 1001,

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

    section CallTarget+Inlining+NGEN
    This PR (4946) - mean (687ms)  : 670, 704
     .   : milestone, 687,
    master - mean (692ms)  : 676, 708
     .   : milestone, 692,

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

    section CallTarget+Inlining+NGEN
    This PR (4946) - mean (663ms)  : 635, 692
     .   : milestone, 663,
    master - mean (663ms)  : 634, 692
     .   : milestone, 663,

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

    section CallTarget+Inlining+NGEN
    This PR (4946) - mean (1,133ms)  : 1109, 1156
     .   : milestone, 1133,
    master - mean (1,135ms)  : 1109, 1161
     .   : milestone, 1135,

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

    section CallTarget+Inlining+NGEN
    This PR (4946) - mean (1,091ms)  : 1063, 1119
     .   : milestone, 1091,
    master - mean (1,092ms)  : 1063, 1122
     .   : milestone, 1092,

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

    section CallTarget+Inlining+NGEN
    This PR (4946) - mean (1,063ms)  : 1034, 1093
     .   : milestone, 1063,
    master - mean (1,057ms)  : 1029, 1085
     .   : milestone, 1057,

Loading

@andrewlock
Copy link
Member Author

Benchmarks Report 🐌

Benchmarks for #4946 compared to master:

  • 1 benchmarks are faster, with geometric mean 1.126
  • 4 benchmarks are slower, with geometric mean 1.288
  • 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 8.73μs 48.3ns 294ns 0.0211 0.00843 0 7.48 KB
master StartStopWithChild netcoreapp3.1 10.7μs 59ns 364ns 0.0272 0.0109 0 7.58 KB
master StartStopWithChild net472 16.6μs 58ns 217ns 1.35 0.354 0.118 7.95 KB
#4946 StartStopWithChild net6.0 8.51μs 43.6ns 213ns 0.0247 0.0123 0 7.47 KB
#4946 StartStopWithChild netcoreapp3.1 10.6μs 57.5ns 320ns 0.0312 0.0104 0 7.58 KB
#4946 StartStopWithChild net472 16.8μs 42.2ns 163ns 1.36 0.36 0.126 7.95 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 460μs 93ns 348ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 642μs 278ns 1.08μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 795μs 456ns 1.77μs 0.396 0 0 3.3 KB
#4946 WriteAndFlushEnrichedTraces net6.0 462μs 200ns 721ns 0 0 0 2.7 KB
#4946 WriteAndFlushEnrichedTraces netcoreapp3.1 614μs 149ns 575ns 0 0 0 2.7 KB
#4946 WriteAndFlushEnrichedTraces net472 776μs 256ns 992ns 0.388 0 0 3.3 KB
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #4946

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody‑net6.0 1.277 133.75 170.75

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 43.6μs 25.8ns 93.1ns 0.0217 0 0 1.77 KB
master AllCycleSimpleBody netcoreapp3.1 47μs 38.6ns 145ns 0.0234 0 0 1.74 KB
master AllCycleSimpleBody net472 49μs 137ns 529ns 0.265 0 0 1.81 KB
master AllCycleMoreComplexBody net6.0 214μs 229ns 888ns 0.106 0 0 9.25 KB
master AllCycleMoreComplexBody netcoreapp3.1 225μs 97.6ns 365ns 0.112 0 0 9.14 KB
master AllCycleMoreComplexBody net472 238μs 122ns 474ns 1.42 0 0 9.32 KB
master ObjectExtractorSimpleBody net6.0 134ns 0.0335ns 0.125ns 0.00393 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 185ns 0.0816ns 0.316ns 0.00373 0 0 272 B
master ObjectExtractorSimpleBody net472 152ns 0.0827ns 0.309ns 0.0446 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 2.77μs 1.5ns 5.63ns 0.0526 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 3.66μs 1.11ns 4.16ns 0.0493 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 3.45μs 0.954ns 3.44ns 0.602 0.00517 0 3.8 KB
#4946 AllCycleSimpleBody net6.0 44.5μs 99.3ns 384ns 0.0225 0 0 1.77 KB
#4946 AllCycleSimpleBody netcoreapp3.1 46.1μs 136ns 528ns 0.0233 0 0 1.74 KB
#4946 AllCycleSimpleBody net472 49.2μs 26.8ns 104ns 0.265 0 0 1.81 KB
#4946 AllCycleMoreComplexBody net6.0 211μs 83ns 288ns 0.107 0 0 9.25 KB
#4946 AllCycleMoreComplexBody netcoreapp3.1 226μs 108ns 419ns 0.111 0 0 9.14 KB
#4946 AllCycleMoreComplexBody net472 238μs 70.4ns 244ns 1.42 0 0 9.32 KB
#4946 ObjectExtractorSimpleBody net6.0 171ns 0.237ns 0.888ns 0.00395 0 0 280 B
#4946 ObjectExtractorSimpleBody netcoreapp3.1 180ns 0.0683ns 0.256ns 0.00372 0 0 272 B
#4946 ObjectExtractorSimpleBody net472 152ns 0.132ns 0.512ns 0.0446 0 0 281 B
#4946 ObjectExtractorMoreComplexBody net6.0 2.8μs 1.49ns 5.58ns 0.0534 0 0 3.78 KB
#4946 ObjectExtractorMoreComplexBody netcoreapp3.1 3.82μs 1.46ns 5.66ns 0.0496 0 0 3.69 KB
#4946 ObjectExtractorMoreComplexBody net472 3.37μs 1.18ns 4.58ns 0.602 0.00675 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 52.4μs 307ns 2.91μs 0.219 0 0 16.06 KB
master RunWaf(args=NestedMap (10)) netcoreapp3.1 67.5μs 363ns 2.09μs 0.206 0 0 16.06 KB
master RunWaf(args=NestedMap (10)) net472 98.9μs 40.5ns 146ns 2.55 0.0943 0 16.14 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 116μs 568ns 2.47μs 0.282 0 0 22.41 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 134μs 130ns 451ns 0.268 0 0 22.36 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net472 165μs 91ns 353ns 3.55 0.165 0 22.7 KB
master RunWaf(args=NestedMap (100)) net6.0 103μs 37.3ns 140ns 0.463 0 0 32.76 KB
master RunWaf(args=NestedMap (100)) netcoreapp3.1 133μs 739ns 4.96μs 0.404 0 0 33.33 KB
master RunWaf(args=NestedMap (100)) net472 191μs 100ns 389ns 5.31 0.366 0 33.67 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) net6.0 163μs 45.6ns 165ns 0.52 0 0 39.1 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) netcoreapp3.1 214μs 806ns 3.12μs 0.518 0 0 39.63 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) net472 267μs 834ns 3.23μs 6.28 0.392 0 40.23 KB
master RunWaf(args=NestedMap (20)) net6.0 96.7μs 533ns 3.11μs 0.454 0 0 32.18 KB
master RunWaf(args=NestedMap (20)) netcoreapp3.1 129μs 397ns 1.54μs 0.443 0 0 32.3 KB
master RunWaf(args=NestedMap (20)) net472 188μs 66.8ns 259ns 5.12 0.365 0 32.63 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 172μs 94.7ns 367ns 0.518 0 0 38.53 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 203μs 1.03μs 4.49μs 0.498 0 0 38.6 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net472 263μs 1.23μs 4.75μs 6.16 0.513 0 39.2 KB
#4946 RunWaf(args=NestedMap (10)) net6.0 53.9μs 22.7ns 88ns 0.213 0 0 16.06 KB
#4946 RunWaf(args=NestedMap (10)) netcoreapp3.1 67.4μs 373ns 2.17μs 0.212 0 0 16.06 KB
#4946 RunWaf(args=NestedMap (10)) net472 97.5μs 488ns 2.18μs 2.56 0.0929 0 16.14 KB
#4946 RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 116μs 142ns 510ns 0.289 0 0 22.41 KB
#4946 RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 134μs 533ns 2.97μs 0.266 0 0 22.36 KB
#4946 RunWafWithAttack(args=Neste(...)tack) [22]) net472 166μs 81.8ns 317ns 3.6 0.164 0 22.7 KB
#4946 RunWaf(args=NestedMap (100)) net6.0 101μs 583ns 4.55μs 0.461 0 0 32.76 KB
#4946 RunWaf(args=NestedMap (100)) netcoreapp3.1 134μs 573ns 2.22μs 0.437 0 0 33.33 KB
#4946 RunWaf(args=NestedMap (100)) net472 191μs 72.7ns 281ns 5.32 0.373 0 33.67 KB
#4946 RunWafWithAttack(args=Neste(...)tack) [23]) net6.0 174μs 972ns 6.3μs 0.459 0 0 39.1 KB
#4946 RunWafWithAttack(args=Neste(...)tack) [23]) netcoreapp3.1 205μs 127ns 492ns 0.491 0 0 39.63 KB
#4946 RunWafWithAttack(args=Neste(...)tack) [23]) net472 262μs 1.05μs 4.06μs 6.28 0.401 0 40.23 KB
#4946 RunWaf(args=NestedMap (20)) net6.0 102μs 159ns 617ns 0.453 0 0 32.18 KB
#4946 RunWaf(args=NestedMap (20)) netcoreapp3.1 133μs 109ns 424ns 0.405 0 0 32.3 KB
#4946 RunWaf(args=NestedMap (20)) net472 183μs 248ns 959ns 5.16 0.362 0 32.63 KB
#4946 RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 165μs 63.7ns 221ns 0.537 0 0 38.53 KB
#4946 RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 208μs 774ns 3μs 0.506 0 0 38.6 KB
#4946 RunWafWithAttack(args=Neste(...)tack) [22]) net472 264μs 1.17μs 4.54μs 6.15 0.512 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 174μs 166ns 642ns 0.173 0 0 18.25 KB
master SendRequest netcoreapp3.1 195μs 231ns 893ns 0.195 0 0 20.41 KB
master SendRequest net472 0.00169ns 0.000346ns 0.00134ns 0 0 0 0 b
#4946 SendRequest net6.0 173μs 229ns 888ns 0.261 0 0 18.25 KB
#4946 SendRequest netcoreapp3.1 193μs 419ns 1.62μs 0.193 0 0 20.41 KB
#4946 SendRequest net472 7.5E‑06ns 7.5E‑06ns 2.81E‑05ns 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 550μs 255ns 986ns 0.541 0 0 41.67 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 641μs 795ns 2.87μs 0.319 0 0 41.72 KB
master WriteAndFlushEnrichedTraces net472 829μs 4.03μs 18μs 8.39 2.52 0.419 53.25 KB
#4946 WriteAndFlushEnrichedTraces net6.0 550μs 406ns 1.41μs 0.571 0 0 41.54 KB
#4946 WriteAndFlushEnrichedTraces netcoreapp3.1 649μs 1.19μs 4.6μs 0.326 0 0 41.71 KB
#4946 WriteAndFlushEnrichedTraces net472 820μs 2.54μs 9.84μs 8.41 2.4 0.401 53.26 KB
Benchmarks.Trace.DbCommandBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #4946

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑net6.0 1.123 1,022.40 1,147.85

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 1.02μs 1.24ns 4.8ns 0.0106 0 0 768 B
master ExecuteNonQuery netcoreapp3.1 1.48μs 0.708ns 2.65ns 0.0104 0 0 768 B
master ExecuteNonQuery net472 1.77μs 0.941ns 3.64ns 0.115 0 0 730 B
#4946 ExecuteNonQuery net6.0 1.15μs 0.656ns 2.54ns 0.011 0 0 768 B
#4946 ExecuteNonQuery netcoreapp3.1 1.42μs 0.576ns 2.23ns 0.0107 0 0 768 B
#4946 ExecuteNonQuery net472 1.81μs 0.725ns 2.81ns 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.24μs 1.21ns 4.54ns 0.0132 0 0 936 B
master CallElasticsearch netcoreapp3.1 1.58μs 0.937ns 3.63ns 0.0126 0 0 936 B
master CallElasticsearch net472 2.52μs 1.08ns 4.18ns 0.151 0.00126 0 955 B
master CallElasticsearchAsync net6.0 1.27μs 0.499ns 1.93ns 0.0127 0 0 912 B
master CallElasticsearchAsync netcoreapp3.1 1.6μs 0.542ns 1.95ns 0.0136 0 0 984 B
master CallElasticsearchAsync net472 2.63μs 0.572ns 2.14ns 0.16 0 0 1.01 KB
#4946 CallElasticsearch net6.0 1.26μs 0.816ns 3.05ns 0.0132 0 0 936 B
#4946 CallElasticsearch netcoreapp3.1 1.56μs 0.776ns 3.01ns 0.0124 0 0 936 B
#4946 CallElasticsearch net472 2.49μs 0.729ns 2.82ns 0.152 0 0 955 B
#4946 CallElasticsearchAsync net6.0 1.4μs 0.456ns 1.77ns 0.0126 0 0 912 B
#4946 CallElasticsearchAsync netcoreapp3.1 1.66μs 0.549ns 2.05ns 0.0132 0 0 984 B
#4946 CallElasticsearchAsync net472 2.69μs 0.758ns 2.83ns 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.29μs 0.691ns 2.68ns 0.0128 0 0 912 B
master ExecuteAsync netcoreapp3.1 1.64μs 3.07ns 11.9ns 0.0123 0 0 912 B
master ExecuteAsync net472 1.83μs 0.44ns 1.7ns 0.138 0 0 875 B
#4946 ExecuteAsync net6.0 1.4μs 0.461ns 1.72ns 0.0126 0 0 912 B
#4946 ExecuteAsync netcoreapp3.1 1.66μs 0.518ns 1.87ns 0.0124 0 0 912 B
#4946 ExecuteAsync net472 1.86μs 0.919ns 3.56ns 0.139 0 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.11μs 1.81ns 6.54ns 0.0287 0 0 2.1 KB
master SendAsync netcoreapp3.1 4.96μs 2.78ns 10.4ns 0.0342 0 0 2.63 KB
master SendAsync net472 7.77μs 3.94ns 15.3ns 0.523 0 0 3.31 KB
#4946 SendAsync net6.0 4.12μs 2.49ns 8.99ns 0.0287 0 0 2.1 KB
#4946 SendAsync netcoreapp3.1 4.84μs 2.36ns 8.82ns 0.0362 0 0 2.63 KB
#4946 SendAsync net472 7.6μs 5.65ns 21.9ns 0.525 0 0 3.31 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #4946

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark(parameters: System.Collections.Generic.List`1[System.String])‑net6.0 1.716 65,150.00 111,800.00 bimodal

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark(parameters=Syste(...)ring] [48]) net6.0 58.4μs 769ns 7.58μs 0 0 0 43.44 KB
master StringConcatBenchmark(parameters=Syste(...)ring] [48]) netcoreapp3.1 53.5μs 238ns 923ns 0 0 0 42.64 KB
master StringConcatBenchmark(parameters=Syste(...)ring] [48]) net472 38.2μs 138ns 515ns 0 0 0 59.89 KB
master StringConcatAspectBenchmark(parameters=Syste(...)ring] [48]) net6.0 65μs 289ns 1.08μs 0 0 0 43.29 KB
master StringConcatAspectBenchmark(parameters=Syste(...)ring] [48]) netcoreapp3.1 97.6μs 3.24μs 32.1μs 0 0 0 42.64 KB
master StringConcatAspectBenchmark(parameters=Syste(...)ring] [48]) net472 62.2μs 282ns 1.09μs 0 0 0 57.34 KB
#4946 StringConcatBenchmark(parameters=Syste(...)ring] [48]) net6.0 62.3μs 903ns 8.9μs 0 0 0 43.44 KB
#4946 StringConcatBenchmark(parameters=Syste(...)ring] [48]) netcoreapp3.1 53.2μs 175ns 606ns 0 0 0 42.64 KB
#4946 StringConcatBenchmark(parameters=Syste(...)ring] [48]) net472 38μs 66.4ns 239ns 0 0 0 59.7 KB
#4946 StringConcatAspectBenchmark(parameters=Syste(...)ring] [48]) net6.0 107μs 2.78μs 27.6μs 0 0 0 43.29 KB
#4946 StringConcatAspectBenchmark(parameters=Syste(...)ring] [48]) netcoreapp3.1 102μs 3.93μs 39μs 0 0 0 42.64 KB
#4946 StringConcatAspectBenchmark(parameters=Syste(...)ring] [48]) net472 62μs 240ns 897ns 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.58μs 0.753ns 2.82ns 0.0219 0 0 1.57 KB
master EnrichedLog netcoreapp3.1 2.28μs 0.618ns 2.31ns 0.021 0 0 1.57 KB
master EnrichedLog net472 2.72μs 5.44ns 21.1ns 0.238 0 0 1.5 KB
#4946 EnrichedLog net6.0 1.43μs 0.878ns 3.28ns 0.0222 0 0 1.57 KB
#4946 EnrichedLog netcoreapp3.1 2.21μs 0.668ns 2.5ns 0.0209 0 0 1.57 KB
#4946 EnrichedLog net472 2.68μs 3.75ns 14ns 0.237 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 112μs 91.6ns 355ns 0.0565 0 0 4.21 KB
master EnrichedLog netcoreapp3.1 119μs 161ns 622ns 0 0 0 4.21 KB
master EnrichedLog net472 146μs 119ns 461ns 0.656 0.219 0 4.39 KB
#4946 EnrichedLog net6.0 115μs 105ns 393ns 0.0574 0 0 4.21 KB
#4946 EnrichedLog netcoreapp3.1 120μs 217ns 841ns 0 0 0 4.21 KB
#4946 EnrichedLog net472 149μs 213ns 826ns 0.67 0.223 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 3.06μs 1.31ns 5.06ns 0.029 0 0 2.13 KB
master EnrichedLog netcoreapp3.1 4.22μs 1.71ns 6.64ns 0.0274 0 0 2.13 KB
master EnrichedLog net472 4.92μs 2.95ns 11.4ns 0.308 0 0 1.95 KB
#4946 EnrichedLog net6.0 2.99μs 1ns 3.75ns 0.03 0 0 2.13 KB
#4946 EnrichedLog netcoreapp3.1 4.28μs 1.24ns 4.81ns 0.0278 0 0 2.13 KB
#4946 EnrichedLog net472 4.91μs 6.38ns 24.7ns 0.309 0 0 1.95 KB
Benchmarks.Trace.RedisBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #4946

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.RedisBenchmark.SendReceive‑net6.0 1.118 1,318.10 1,473.13

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net6.0 1.32μs 0.663ns 2.39ns 0.0158 0 0 1.1 KB
master SendReceive netcoreapp3.1 1.75μs 0.552ns 2.14ns 0.0147 0 0 1.1 KB
master SendReceive net472 2.12μs 3.51ns 13.6ns 0.177 0 0 1.12 KB
#4946 SendReceive net6.0 1.47μs 1.19ns 4.62ns 0.0155 0 0 1.1 KB
#4946 SendReceive netcoreapp3.1 1.73μs 0.49ns 1.83ns 0.0154 0 0 1.1 KB
#4946 SendReceive net472 2.19μs 0.972ns 3.77ns 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.69μs 0.478ns 1.72ns 0.0216 0 0 1.53 KB
master EnrichedLog netcoreapp3.1 3.72μs 3.28ns 12.7ns 0.0204 0 0 1.58 KB
master EnrichedLog net472 4.17μs 2.02ns 7.84ns 0.31 0 0 1.97 KB
#4946 EnrichedLog net6.0 2.69μs 0.49ns 1.83ns 0.0215 0 0 1.53 KB
#4946 EnrichedLog netcoreapp3.1 4.03μs 1.77ns 6.64ns 0.0201 0 0 1.58 KB
#4946 EnrichedLog net472 4.44μs 4.21ns 16.3ns 0.312 0 0 1.97 KB
Benchmarks.Trace.SpanBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #4946

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 1.126 522.60 464.22

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 522ns 0.114ns 0.441ns 0.00736 0 0 536 B
master StartFinishSpan netcoreapp3.1 737ns 0.237ns 0.887ns 0.00714 0 0 536 B
master StartFinishSpan net472 742ns 0.34ns 1.32ns 0.0854 0 0 538 B
master StartFinishScope net6.0 582ns 0.756ns 2.93ns 0.00925 0 0 656 B
master StartFinishScope netcoreapp3.1 838ns 0.861ns 3.34ns 0.00886 0 0 656 B
master StartFinishScope net472 978ns 1.92ns 7.42ns 0.0982 0 0 618 B
#4946 StartFinishSpan net6.0 464ns 0.131ns 0.507ns 0.00754 0 0 536 B
#4946 StartFinishSpan netcoreapp3.1 689ns 0.191ns 0.715ns 0.00729 0 0 536 B
#4946 StartFinishSpan net472 761ns 1.24ns 4.82ns 0.0852 0 0 538 B
#4946 StartFinishScope net6.0 577ns 0.271ns 0.938ns 0.00927 0 0 656 B
#4946 StartFinishScope netcoreapp3.1 857ns 0.453ns 1.75ns 0.00903 0 0 656 B
#4946 StartFinishScope net472 966ns 0.693ns 2.68ns 0.0978 0 0 618 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 593ns 0.46ns 1.78ns 0.0091 0 0 656 B
master RunOnMethodBegin netcoreapp3.1 875ns 1.51ns 5.85ns 0.0088 0 0 656 B
master RunOnMethodBegin net472 1.11μs 0.558ns 2.16ns 0.0982 0 0 618 B
#4946 RunOnMethodBegin net6.0 637ns 0.205ns 0.792ns 0.00917 0 0 656 B
#4946 RunOnMethodBegin netcoreapp3.1 966ns 0.358ns 1.38ns 0.00869 0 0 656 B
#4946 RunOnMethodBegin net472 1.13μs 0.842ns 3.26ns 0.0978 0 0 618 B

@andrewlock andrewlock merged commit 0578d89 into master Dec 1, 2023
52 of 54 checks passed
@andrewlock andrewlock deleted the andrew/default-flush-interval-in-serverless branch December 1, 2023 16:28
@github-actions github-actions bot added this to the vNext milestone Dec 1, 2023
duncanpharvey added a commit that referenced this pull request Aug 20, 2024
… for non-consumption plans (#5792)

[SVLS-4943](https://datadoghq.atlassian.net/browse/SVLS-4943)
## Summary of changes
Expand the mini-agent use case in Azure Function Apps from currently
only consumption plan to
- Windows still only consumption as other plans tend to have regular
agent solutions such as extension
- Linux servers will all use mini-agent as this is the only viable
solution we see so far.

## Reason for change
- We are trying to put the mini-agent into Private Beta
- Some customers are asking specifically.

## Implementation details

I've checked the related configurations as listed below and I think they
should still apply in the linux server case if we are starting to use
mini-agent.
### [History] Usage of IsRunningInAzureFunctionsConsumptionPlan
- First added by [the mini-agent
PR](https://github.com/DataDog/dd-trace-dotnet/pull/4204/files)
- In `StatsComputationEnabledInternal`. The same PR added.
- In `TraceBatchInterval`, used to set the trace batch interval to 0.
[PR Link](#4946)
- In `IsRemoteConfigurationAvailable`, used to indicate remote
configuration not available.
- In `isServerless` of TelemetrySettings. Used to turn off Metrics by
default. [PR
link](https://github.com/DataDog/dd-trace-dotnet/pull/4625/files).
## Test coverage
minor updates to existing tests 

## Other notes
I've had the idea that we first detect whether the mini-agent path
exists and then set related variables listed above assuming mini-agent
will be used. However, after some consideration, I think this approach
has two main problems.
1. It's a bit of a chicken-egg situation where we want to know the
settings when checking the path but also want to know the path when we
set the setting. Logically we can sort this out by putting down the path
as one of the setting. Is it worth adding a new configuration to
TracerSetting?
2. I don't know what's the best place to check the `DD_MINI_AGENT_PATH`.
Let me know if this idea sounds better? Otherwise, let's keep it as
simple as this PR.
<!-- 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. -->


[SVLS-4943]:
https://datadoghq.atlassian.net/browse/SVLS-4943?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

---------

Co-authored-by: Duncan Harvey <35278470+duncanpharvey@users.noreply.github.com>
Co-authored-by: Lucas Pimentel <lucas.pimentel@datadoghq.com>
Co-authored-by: Andrew Lock <andrew.lock@datadoghq.com>
Co-authored-by: Duncan Harvey <duncan.harvey@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:serverless 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.

5 participants