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

Minor refactor of BatchingSink #4402

Merged
merged 3 commits into from
Jul 20, 2023

Conversation

andrewlock
Copy link
Member

Summary of changes

  • Update BatchingSink to support generic T events, instead of only direct-submission logs
  • Rename DatadogSink to DirectSubmissionLogSink

Reason for change

When sending telemetry logs, we want to reuse the BatchingSink implementation, but currently it's tied to direct log submission.

Renaming the derived DatadogSink to be clearer about what it is

Implementation details

A few minor tweaks to BatchingSink and a rename

Test coverage

A few unit tests for the new CloseImmediately() method, but otherwise covered by existing tests

Other details

Stacked on #4388

@andrewlock andrewlock requested a review from a team as a code owner July 14, 2023 10:48
@andrewlock andrewlock force-pushed the andrew/telemetry/refactor-batching-sink branch from d580aaa to 2c49a99 Compare July 14, 2023 11:24
@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Jul 14, 2023

Datadog Report

Branch report: andrew/telemetry/refactor-batching-sink
Commit report: 7d4359a

❄️ dd-trace-dotnet: 0 Failed, 2 New Flaky, 295175 Passed, 1091 Skipped, 29m 31.26s Wall Time

New Flaky Tests (2)

  • CheckCpuTimeForGcThreadsIsReported - Datadog.Profiler.IntegrationTests.GarbageCollections.GarbageCollectorCpuTimeTest - Last Failure

    Expand for error
     Expected SamplesHelper.GetSamples(runner.Environment.PprofDir) {(|lm:System.Private.CoreLib |ns:System |ct:String |cg: |fn:Ctor |fg: |sg:(char* ptr)
     |lm:System.Private.CoreLib |ns:System |ct:AppContext |cg: |fn:Setup |fg: |sg:(char** pNames, char** pValues, int count), Perftools.Profiles.Label[], System.Int64[]), (|lm:System.Private.CoreLib |ns:System.Globalization |ct:CultureData |cg: |fn:IndexOfTimePart |fg: |sg:(string format, int startIndex, string timeParts)
     |lm:System.Private.CoreLib |ns:System.Globalization |ct:CultureData |cg: |fn:GetSeparator |fg: |sg:(string format, string timeParts)
     |lm:System.Private.CoreLib |ns:System.Globalization |ct:CultureData |cg: |fn:get_TimeSeparator |fg: |sg:()
     |lm:System.Private.CoreLib |ns:System.Globalization |ct:DateTimeFormatInfo |cg: |fn:InitializeOverridableProperties |fg: |sg:(System.Globalization.CultureData cultureData, System.Globalization.CalendarId calendarId)
     |lm:System.Private.CoreLib |ns:System.Globalization |ct:CultureInfo |cg: |fn:get_DateTimeFormat |fg: |sg:()
     |lm:System.Private.CoreLib |ns:System.Globalization |ct:DateTimeFormatInfo |cg: |fn:get_CurrentInfo |fg: |sg:()
     |lm:System.Private.CoreLib |ns:System |ct:DateTimeFormat |cg: |fn:Format |fg: |sg:(System.DateTime dateTime, string format, System.IFormatProvider provider, System.TimeSpan offset)
     |lm:Samples.Computer01 |ns:Samples.Computer01 |ct:Program |cg: |fn:Main |fg: |sg:(string[] args), Perftools.Profiles.Label[], System.Int64[]), (|lm:System.Private.CoreLib |ns:System |ct:String |cg: |fn:Ctor |fg: |sg:(char* ptr)
     |lm:System.Private.CoreLib |ns:System |ct:AppContext |cg: |fn:Setup |fg: |sg:(char** pNames, char** pValues, int count), Perftools.Profiles.Label[], System.Int64[]), (|lm:System.Private.CoreLib |ns:System.Diagnostics.Tracing |ct:EventSource |cg: |fn:CreateManifestAndDescriptors |fg: |sg:(System.Type eventSourceType, string eventSourceDllName, System.Diagnostics.Tracing.EventSource source, System.Diagnostics.Tracing.EventManifestOptions flags)
     ...
    
  • TestIastInsecureCookieRequest - Datadog.Trace.Security.IntegrationTests.Iast.AspNetCore5IastTestsFullSamplingIastEnabled - Last Failure

    Expand for error
     Results do not match.
     Differences:
     Received: Security.AspNetCore5.enableIast=True.path =_Iast_AllVulnerabilitiesCookie.received.txt
     Verified: Security.AspNetCore5.enableIast=True.path =_Iast_AllVulnerabilitiesCookie.verified.txt
     Received Content:
     [
       {
         TraceId: Id_1,
         SpanId: Id_2,
         Name: aspnet_core.request,
     ...
    

@andrewlock

This comment has been minimized.

@andrewlock

This comment has been minimized.

@andrewlock

This comment has been minimized.

@andrewlock andrewlock force-pushed the andrew/telemetry/capture-metrics-more-regularly branch from 8fab463 to 8f66709 Compare July 19, 2023 11:27
@andrewlock andrewlock requested a review from a team as a code owner July 19, 2023 11:27
@andrewlock andrewlock force-pushed the andrew/telemetry/refactor-batching-sink branch from 2c49a99 to 4c40e4c Compare July 19, 2023 11:57
@andrewlock andrewlock requested review from a team as code owners July 19, 2023 11:57
@andrewlock

This comment has been minimized.

@andrewlock

This comment has been minimized.

@andrewlock

This comment has been minimized.

@andrewlock andrewlock force-pushed the andrew/telemetry/capture-metrics-more-regularly branch from be1d089 to db5057c Compare July 19, 2023 16:35
@andrewlock andrewlock force-pushed the andrew/telemetry/refactor-batching-sink branch from 4c40e4c to d317112 Compare July 19, 2023 16:35
@andrewlock

This comment has been minimized.

@andrewlock

This comment has been minimized.

@andrewlock
Copy link
Member Author

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 (4402) (11.316M)   : 0, 11316206
    master (11.346M)   : 0, 11346232
    benchmarks/2.33.0 (10.950M)   : 0, 10949608
    benchmarks/2.9.0 (11.208M)   : 0, 11207974

    section Automatic
    This PR (4402) (7.878M)   : 0, 7877830
    master (7.835M)   : 0, 7835027
    benchmarks/2.33.0 (7.621M)   : 0, 7620707
    benchmarks/2.9.0 (8.183M)   : 0, 8183469

    section Trace stats
    master (7.934M)   : 0, 7934441
    benchmarks/2.33.0 (7.602M)   : 0, 7602038

    section Manual
    This PR (4402) (10.045M)   : 0, 10044983
    master (10.162M)   : 0, 10162267
    benchmarks/2.33.0 (9.770M)   : 0, 9770235

    section Manual + Automatic
    This PR (4402) (7.629M)   : 0, 7628682
    master (7.595M)   : 0, 7595401
    benchmarks/2.33.0 (7.189M)   : 0, 7188658

    section Version Conflict
    master (6.823M)   : 0, 6822653
    benchmarks/2.33.0 (6.553M)   : 0, 6553316

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (4402) (9.593M)   : 0, 9592992
    master (9.759M)   : 0, 9758817
    benchmarks/2.33.0 (9.426M)   : 0, 9425603
    benchmarks/2.9.0 (9.560M)   : 0, 9560392

    section Automatic
    This PR (4402) (6.750M)   : 0, 6750166
    master (6.577M)   : 0, 6576650
    benchmarks/2.33.0 (6.803M)   : 0, 6802932

    section Trace stats
    master (6.732M)   : 0, 6731910
    benchmarks/2.33.0 (6.810M)   : 0, 6810447

    section Manual
    This PR (4402) (8.442M)   : 0, 8441807
    master (8.645M)   : 0, 8645166
    benchmarks/2.33.0 (8.435M)   : 0, 8434569

    section Manual + Automatic
    This PR (4402) (6.437M)   : 0, 6437017
    master (6.478M)   : 0, 6478309
    benchmarks/2.33.0 (6.465M)   : 0, 6465149

    section Version Conflict
    master (6.010M)   : 0, 6009663
    benchmarks/2.33.0 (5.807M)   : 0, 5806690

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (4402) (9.924M)   : 0, 9923998
    master (10.834M)   : 0, 10834218
    benchmarks/2.33.0 (9.426M)   : 0, 9426080
    benchmarks/2.9.0 (10.159M)   : 0, 10158802

    section Automatic
    This PR (4402) (7.133M)   : crit ,0, 7133063
    master (7.787M)   : 0, 7786725
    benchmarks/2.33.0 (6.469M)   : 0, 6468939
    benchmarks/2.9.0 (7.476M)   : 0, 7476188

    section Trace stats
    master (7.331M)   : 0, 7330898
    benchmarks/2.33.0 (6.830M)   : 0, 6830314

    section Manual
    This PR (4402) (9.001M)   : 0, 9000893
    master (9.223M)   : 0, 9222794
    benchmarks/2.33.0 (8.108M)   : 0, 8108026

    section Manual + Automatic
    This PR (4402) (6.937M)   : 0, 6936895
    master (7.256M)   : 0, 7255836
    benchmarks/2.33.0 (6.856M)   : 0, 6856379

    section Version Conflict
    master (6.759M)   : 0, 6758545
    benchmarks/2.33.0 (5.893M)   : 0, 5893016

Loading
gantt
    title Throughput Linux x64 (ASM) (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (4402) (7.511M)   : 0, 7510767
    master (7.523M)   : 0, 7522826
    benchmarks/2.33.0 (7.765M)   : 0, 7764607
    benchmarks/2.9.0 (7.668M)   : 0, 7667875

    section No attack
    This PR (4402) (2.130M)   : 0, 2130475
    master (2.165M)   : 0, 2165309
    benchmarks/2.33.0 (2.209M)   : 0, 2208725
    benchmarks/2.9.0 (3.135M)   : 0, 3135187

    section Attack
    This PR (4402) (1.851M)   : 0, 1850924
    master (1.840M)   : 0, 1839905
    benchmarks/2.33.0 (1.911M)   : 0, 1910909
    benchmarks/2.9.0 (2.534M)   : 0, 2533760

    section Blocking
    This PR (4402) (3.742M)   : 0, 3742427
    master (3.756M)   : 0, 3756223
    benchmarks/2.33.0 (3.861M)   : 0, 3860900

Loading

@andrewlock andrewlock force-pushed the andrew/telemetry/capture-metrics-more-regularly branch from db5057c to 863ec1b Compare July 20, 2023 09:48
Base automatically changed from andrew/telemetry/capture-metrics-more-regularly to master July 20, 2023 11:42
@andrewlock andrewlock force-pushed the andrew/telemetry/refactor-batching-sink branch from d317112 to 7d4359a Compare July 20, 2023 12:15
@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 (4402) - mean (3,016ms)  : 2909, 3124
     .   : milestone, 3016,
    master - mean (3,006ms)  : 2948, 3063
     .   : milestone, 3006,

    section CallTarget+Inlining+NGEN
    This PR (4402) - mean (3,817ms)  : 3758, 3876
     .   : milestone, 3817,
    master - mean (3,828ms)  : 3721, 3934
     .   : milestone, 3828,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4402) - mean (3,110ms)  : 3005, 3214
     .   : milestone, 3110,
    master - mean (3,110ms)  : 3026, 3193
     .   : milestone, 3110,

    section CallTarget+Inlining+NGEN
    This PR (4402) - mean (3,608ms)  : 3567, 3650
     .   : milestone, 3608,
    master - mean (3,610ms)  : 3532, 3687
     .   : milestone, 3610,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4402) - mean (3,118ms)  : 3019, 3216
     .   : milestone, 3118,
    master - mean (3,106ms)  : 3016, 3196
     .   : milestone, 3106,

    section CallTarget+Inlining+NGEN
    This PR (4402) - mean (3,590ms)  : 3496, 3683
     .   : milestone, 3590,
    master - mean (3,569ms)  : 3513, 3625
     .   : milestone, 3569,

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

    section CallTarget+Inlining+NGEN
    This PR (4402) - mean (1,122ms)  : 1089, 1156
     .   : milestone, 1122,
    master - mean (1,124ms)  : 1091, 1157
     .   : milestone, 1124,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4402) - mean (373ms)  : 366, 379
     .   : milestone, 373,
    master - mean (376ms)  : 370, 382
     .   : milestone, 376,

    section CallTarget+Inlining+NGEN
    This PR (4402) - mean (1,178ms)  : 1155, 1202
     .   : milestone, 1178,
    master - mean (1,192ms)  : 1168, 1216
     .   : milestone, 1192,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4402) - mean (360ms)  : 356, 365
     .   : milestone, 360,
    master - mean (361ms)  : 355, 367
     .   : milestone, 361,

    section CallTarget+Inlining+NGEN
    This PR (4402) - mean (1,131ms)  : 1108, 1154
     .   : milestone, 1131,
    master - mean (1,136ms)  : 1111, 1161
     .   : milestone, 1136,

Loading

@andrewlock
Copy link
Member Author

Benchmarks Report 🐌

Benchmarks for #4402 compared to master:

  • 4 benchmarks are faster, with geometric mean 1.174
  • 2 benchmarks are slower, with geometric mean 1.167
  • 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.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 470μs 254ns 949ns 0 0 0 2.62 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 655μs 203ns 786ns 0 0 0 2.62 KB
master WriteAndFlushEnrichedTraces net472 790μs 460ns 1.72μs 0.393 0 0 3.22 KB
#4402 WriteAndFlushEnrichedTraces net6.0 465μs 208ns 776ns 0 0 0 2.62 KB
#4402 WriteAndFlushEnrichedTraces netcoreapp3.1 630μs 151ns 566ns 0 0 0 2.63 KB
#4402 WriteAndFlushEnrichedTraces net472 792μs 360ns 1.39μs 0.396 0 0 3.22 KB
Benchmarks.Trace.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 37.5μs 89.4ns 346ns 0.0185 0 0 1.69 KB
master AllCycleSimpleBody netcoreapp3.1 39.9μs 90ns 312ns 0.0198 0 0 1.67 KB
master AllCycleSimpleBody net472 42.8μs 110ns 411ns 0.258 0 0 1.73 KB
master AllCycleMoreComplexBody net6.0 216μs 63.3ns 245ns 0.108 0 0 9.26 KB
master AllCycleMoreComplexBody netcoreapp3.1 229μs 71.5ns 258ns 0.115 0 0 9.16 KB
master AllCycleMoreComplexBody net472 235μs 51.2ns 192ns 1.41 0 0 9.33 KB
master ObjectExtractorSimpleBody net6.0 125ns 0.0316ns 0.118ns 0.00393 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 176ns 0.153ns 0.572ns 0.00374 0 0 272 B
master ObjectExtractorSimpleBody net472 153ns 0.102ns 0.396ns 0.0446 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 2.95μs 0.815ns 3.05ns 0.0545 0 0 3.88 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 4.04μs 1.59ns 5.96ns 0.0503 0 0 3.78 KB
master ObjectExtractorMoreComplexBody net472 4.18μs 3.63ns 14ns 0.617 0.00627 0 3.89 KB
#4402 AllCycleSimpleBody net6.0 38.1μs 16.3ns 60.9ns 0.0191 0 0 1.69 KB
#4402 AllCycleSimpleBody netcoreapp3.1 40.4μs 60.8ns 228ns 0.0201 0 0 1.67 KB
#4402 AllCycleSimpleBody net472 42.2μs 20.9ns 78.1ns 0.269 0 0 1.73 KB
#4402 AllCycleMoreComplexBody net6.0 219μs 69.7ns 270ns 0.108 0 0 9.26 KB
#4402 AllCycleMoreComplexBody netcoreapp3.1 225μs 65ns 243ns 0.112 0 0 9.16 KB
#4402 AllCycleMoreComplexBody net472 237μs 44.1ns 171ns 1.42 0 0 9.33 KB
#4402 ObjectExtractorSimpleBody net6.0 117ns 0.0631ns 0.236ns 0.00393 0 0 280 B
#4402 ObjectExtractorSimpleBody netcoreapp3.1 167ns 0.153ns 0.594ns 0.0037 0 0 272 B
#4402 ObjectExtractorSimpleBody net472 141ns 0.136ns 0.528ns 0.0446 0 0 281 B
#4402 ObjectExtractorMoreComplexBody net6.0 3.01μs 0.895ns 3.35ns 0.0542 0 0 3.88 KB
#4402 ObjectExtractorMoreComplexBody netcoreapp3.1 3.96μs 1.7ns 6.35ns 0.0514 0 0 3.78 KB
#4402 ObjectExtractorMoreComplexBody net472 4.05μs 1.86ns 6.69ns 0.618 0.00608 0 3.89 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 169μs 114ns 425ns 0.252 0 0 18.08 KB
master SendRequest netcoreapp3.1 189μs 195ns 754ns 0.188 0 0 20.14 KB
master SendRequest net472 0.000132ns 9.64E‑05ns 0.000348ns 0 0 0 0 b
#4402 SendRequest net6.0 168μs 122ns 474ns 0.166 0 0 18.08 KB
#4402 SendRequest netcoreapp3.1 188μs 267ns 1.03μs 0.187 0 0 20.14 KB
#4402 SendRequest net472 1.74E‑05ns 1.74E‑05ns 6.04E‑05ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #4402

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 41.94 KB 41.56 KB -380 B -0.91%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 519μs 504ns 1.95μs 0.512 0 0 41.58 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 629μs 1.05μs 4.09μs 0.308 0 0 41.94 KB
master WriteAndFlushEnrichedTraces net472 801μs 3.91μs 16.6μs 8.36 2.39 0.398 53.23 KB
#4402 WriteAndFlushEnrichedTraces net6.0 533μs 301ns 1.13μs 0.768 0 0 41.74 KB
#4402 WriteAndFlushEnrichedTraces netcoreapp3.1 615μs 2.36μs 9.14μs 0.308 0 0 41.56 KB
#4402 WriteAndFlushEnrichedTraces net472 773μs 3.16μs 12.2μs 8.33 2.65 0.379 53.23 KB
Benchmarks.Trace.DbCommandBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #4402

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑net6.0 1.125 982.98 873.64

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 983ns 0.237ns 0.919ns 0.0109 0 0 768 B
master ExecuteNonQuery netcoreapp3.1 1.24μs 0.467ns 1.81ns 0.0106 0 0 768 B
master ExecuteNonQuery net472 1.49μs 0.538ns 2.08ns 0.116 0 0 730 B
#4402 ExecuteNonQuery net6.0 873ns 0.546ns 2.12ns 0.0107 0 0 768 B
#4402 ExecuteNonQuery netcoreapp3.1 1.29μs 0.451ns 1.75ns 0.0103 0 0 768 B
#4402 ExecuteNonQuery net472 1.46μs 2.15ns 8.34ns 0.116 0.000725 0 730 B
Benchmarks.Trace.ElasticsearchBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #4402

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net6.0 1.153 1,030.63 1,188.28

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.03μs 0.324ns 1.21ns 0.014 0 0 992 B
master CallElasticsearch netcoreapp3.1 1.35μs 0.29ns 1.09ns 0.0134 0 0 992 B
master CallElasticsearch net472 2.05μs 0.64ns 2.4ns 0.159 0.00103 0 1 KB
master CallElasticsearchAsync net6.0 1.04μs 0.384ns 1.44ns 0.0135 0 0 968 B
master CallElasticsearchAsync netcoreapp3.1 1.48μs 0.52ns 1.94ns 0.0139 0 0 1.04 KB
master CallElasticsearchAsync net472 2.33μs 0.626ns 2.26ns 0.168 0.00117 0 1.06 KB
#4402 CallElasticsearch net6.0 1.19μs 0.44ns 1.7ns 0.0138 0 0 992 B
#4402 CallElasticsearch netcoreapp3.1 1.36μs 0.535ns 2.07ns 0.0135 0 0 992 B
#4402 CallElasticsearch net472 2.04μs 0.661ns 2.56ns 0.159 0.00102 0 1 KB
#4402 CallElasticsearchAsync net6.0 1.07μs 0.321ns 1.24ns 0.0134 0 0 968 B
#4402 CallElasticsearchAsync netcoreapp3.1 1.45μs 0.513ns 1.99ns 0.0139 0 0 1.04 KB
#4402 CallElasticsearchAsync net472 2.2μs 0.4ns 1.55ns 0.168 0.00111 0 1.06 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.14μs 0.372ns 1.44ns 0.0124 0 0 912 B
master ExecuteAsync netcoreapp3.1 1.38μs 0.72ns 2.69ns 0.0122 0 0 912 B
master ExecuteAsync net472 1.52μs 0.494ns 1.85ns 0.139 0.000757 0 875 B
#4402 ExecuteAsync net6.0 1.14μs 0.218ns 0.816ns 0.0125 0 0 912 B
#4402 ExecuteAsync netcoreapp3.1 1.33μs 0.974ns 3.77ns 0.0126 0 0 912 B
#4402 ExecuteAsync net472 1.49μs 0.384ns 1.44ns 0.139 0.000747 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 3.64μs 1.39ns 5.19ns 0.0273 0 0 1.94 KB
master SendAsync netcoreapp3.1 4.42μs 0.774ns 2.9ns 0.0329 0 0 2.48 KB
master SendAsync net472 6.92μs 2.31ns 8.63ns 0.481 0 0 3.05 KB
#4402 SendAsync net6.0 3.59μs 0.903ns 3.5ns 0.0269 0 0 1.94 KB
#4402 SendAsync netcoreapp3.1 4.48μs 4.03ns 15.6ns 0.033 0 0 2.48 KB
#4402 SendAsync net472 6.83μs 1.97ns 7.37ns 0.484 0 0 3.05 KB
Benchmarks.Trace.ILoggerBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #4402

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.ILoggerBenchmark.EnrichedLog‑netcoreapp3.1 1.150 2,056.22 1,788.75

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 1.29μs 0.829ns 3.21ns 0.0224 0 0 1.62 KB
master EnrichedLog netcoreapp3.1 2.06μs 1.31ns 4.92ns 0.0217 0 0 1.62 KB
master EnrichedLog net472 2.27μs 2.92ns 10.9ns 0.244 0 0 1.54 KB
#4402 EnrichedLog net6.0 1.34μs 0.845ns 3.16ns 0.0231 0 0 1.62 KB
#4402 EnrichedLog netcoreapp3.1 1.79μs 1ns 3.87ns 0.0224 0 0 1.62 KB
#4402 EnrichedLog net472 2.29μs 1.64ns 6.35ns 0.245 0 0 1.54 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 111μs 175ns 679ns 0.0561 0 0 4.21 KB
master EnrichedLog netcoreapp3.1 117μs 139ns 519ns 0 0 0 4.21 KB
master EnrichedLog net472 146μs 164ns 614ns 0.655 0.218 0 4.38 KB
#4402 EnrichedLog net6.0 111μs 142ns 533ns 0.0553 0 0 4.21 KB
#4402 EnrichedLog netcoreapp3.1 116μs 255ns 989ns 0.0577 0 0 4.21 KB
#4402 EnrichedLog net472 145μs 122ns 471ns 0.654 0.218 0 4.38 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.74μs 1.27ns 4.74ns 0.0299 0 0 2.18 KB
master EnrichedLog netcoreapp3.1 3.82μs 1.4ns 5.22ns 0.0286 0 0 2.18 KB
master EnrichedLog net472 4.42μs 1.72ns 6.65ns 0.314 0 0 1.99 KB
#4402 EnrichedLog net6.0 2.91μs 0.572ns 2.14ns 0.0306 0 0 2.18 KB
#4402 EnrichedLog netcoreapp3.1 3.74μs 1.27ns 4.91ns 0.0281 0 0 2.18 KB
#4402 EnrichedLog net472 4.6μs 3.08ns 11.9ns 0.314 0 0 1.99 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.27μs 0.574ns 2.07ns 0.0164 0 0 1.16 KB
master SendReceive netcoreapp3.1 1.56μs 0.611ns 2.29ns 0.0156 0 0 1.16 KB
master SendReceive net472 1.78μs 2.84ns 11ns 0.184 0.000898 0 1.16 KB
#4402 SendReceive net6.0 1.27μs 0.5ns 1.87ns 0.0165 0 0 1.16 KB
#4402 SendReceive netcoreapp3.1 1.51μs 2.51ns 9.38ns 0.0156 0 0 1.16 KB
#4402 SendReceive net472 1.77μs 0.808ns 3.02ns 0.184 0 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.5μs 0.927ns 3.59ns 0.0215 0 0 1.53 KB
master EnrichedLog netcoreapp3.1 3.52μs 1.72ns 6.44ns 0.0215 0 0 1.58 KB
master EnrichedLog net472 4.01μs 1.47ns 5.49ns 0.31 0 0 1.96 KB
#4402 EnrichedLog net6.0 2.55μs 0.595ns 2.23ns 0.0217 0 0 1.53 KB
#4402 EnrichedLog netcoreapp3.1 3.5μs 1.59ns 5.94ns 0.021 0 0 1.58 KB
#4402 EnrichedLog net472 3.92μs 0.827ns 3.2ns 0.31 0 0 1.96 KB
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #4402

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 1.180 530.47 626.18

Faster 🎉 in #4402

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 1.313 498.67 379.78
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑netcoreapp3.1 1.117 766.55 686.14

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 499ns 0.198ns 0.743ns 0.00744 0 0 536 B
master StartFinishSpan netcoreapp3.1 530ns 0.261ns 0.976ns 0.00737 0 0 536 B
master StartFinishSpan net472 614ns 0.486ns 1.88ns 0.0854 0 0 538 B
master StartFinishScope net6.0 518ns 0.191ns 0.714ns 0.00931 0 0 656 B
master StartFinishScope netcoreapp3.1 767ns 0.218ns 0.846ns 0.00885 0 0 656 B
master StartFinishScope net472 771ns 0.497ns 1.93ns 0.0981 0 0 618 B
#4402 StartFinishSpan net6.0 380ns 0.124ns 0.465ns 0.00758 0 0 536 B
#4402 StartFinishSpan netcoreapp3.1 626ns 0.22ns 0.825ns 0.00716 0 0 536 B
#4402 StartFinishSpan net472 662ns 2.1ns 8.13ns 0.0852 0 0 538 B
#4402 StartFinishScope net6.0 471ns 1.16ns 4.19ns 0.00911 0 0 656 B
#4402 StartFinishScope netcoreapp3.1 687ns 0.649ns 3.95ns 0.00898 0 0 656 B
#4402 StartFinishScope net472 775ns 0.303ns 1.17ns 0.0981 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 562ns 0.0877ns 0.304ns 0.00933 0 0 656 B
master RunOnMethodBegin netcoreapp3.1 787ns 0.26ns 1.01ns 0.00893 0 0 656 B
master RunOnMethodBegin net472 928ns 0.79ns 2.96ns 0.098 0 0 618 B
#4402 RunOnMethodBegin net6.0 549ns 0.121ns 0.437ns 0.00918 0 0 656 B
#4402 RunOnMethodBegin netcoreapp3.1 870ns 0.287ns 1.07ns 0.00886 0 0 656 B
#4402 RunOnMethodBegin net472 931ns 0.123ns 0.459ns 0.098 0 0 618 B

@andrewlock andrewlock merged commit 35c117a into master Jul 20, 2023
@andrewlock andrewlock deleted the andrew/telemetry/refactor-batching-sink branch July 20, 2023 16:40
@github-actions github-actions bot added this to the vNext milestone Jul 20, 2023
bouwkast pushed a commit that referenced this pull request Jul 31, 2023
* Refactor BatchingSink<T> so we can reuse it with telemetry logs

* minor: rename DatadogSink to DirectSubmissionLogSink

As we are going to have more than one "sink" soon!

* Rename DatadogLogEvent -> DirectSubmissionLogEvent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants