Skip to content

Improve aerospike sample to avoid timeouts#7751

Merged
NachoEchevarria merged 2 commits intomasterfrom
nacho/ImproveAerospikeSample
Nov 3, 2025
Merged

Improve aerospike sample to avoid timeouts#7751
NachoEchevarria merged 2 commits intomasterfrom
nacho/ImproveAerospikeSample

Conversation

@NachoEchevarria
Copy link
Collaborator

@NachoEchevarria NachoEchevarria commented Nov 3, 2025

Summary of changes

We are getting the following flaky error in our integration tests:

2025-10-27T13:32:43.7186618Z 13:32:43 [DBG] [xUnit.net 00:09:13.41] Datadog.Trace.ClrProfiler.IntegrationTests: STARTED: Datadog.Trace.ClrProfiler.IntegrationTests.AerospikeTests.SubmitTraces(4.0.3, v1)
2025-10-27T13:32:56.8742298Z 13:32:56 [DBG] [xUnit.net 00:09:26.57] Datadog.Trace.ClrProfiler.IntegrationTests: SUCCESS: Datadog.Trace.ClrProfiler.IntegrationTests.AerospikeTests.SubmitTraces(4.0.3, v1) (13.1545012s)
2025-10-27T13:32:56.8743768Z 13:32:56 [DBG] [xUnit.net 00:09:26.57] Datadog.Trace.ClrProfiler.IntegrationTests: STARTED: Datadog.Trace.ClrProfiler.IntegrationTests.AerospikeTests.SubmitTraces(4.0.3, v0)
2025-10-27T13:33:10.3154276Z 13:33:10 [DBG] [xUnit.net 00:09:40.01] Datadog.Trace.ClrProfiler.IntegrationTests: SUCCESS: Datadog.Trace.ClrProfiler.IntegrationTests.AerospikeTests.SubmitTraces(4.0.3, v0) (13.4408747s)
2025-10-27T13:33:10.3155380Z 13:33:10 [DBG] [xUnit.net 00:09:40.01] Datadog.Trace.ClrProfiler.IntegrationTests: STARTED: Datadog.Trace.ClrProfiler.IntegrationTests.AerospikeTests.SubmitTraces(5.4.1, v1)
2025-10-27T13:33:23.5189430Z 13:33:23 [DBG] [xUnit.net 00:09:53.21] Datadog.Trace.ClrProfiler.IntegrationTests: SUCCESS: Datadog.Trace.ClrProfiler.IntegrationTests.AerospikeTests.SubmitTraces(5.4.1, v1) (13.2027726s)
2025-10-27T13:33:23.5190606Z 13:33:23 [DBG] [xUnit.net 00:09:53.21] Datadog.Trace.ClrProfiler.IntegrationTests: STARTED: Datadog.Trace.ClrProfiler.IntegrationTests.AerospikeTests.SubmitTraces(5.4.1, v0)
2025-10-27T13:33:41.1650334Z 13:33:41 [DBG] [xUnit.net 00:10:10.86] Datadog.Trace.ClrProfiler.IntegrationTests: FAILURE: Datadog.Trace.ClrProfiler.IntegrationTests.AerospikeTests.SubmitTraces(5.4.1, v0) (17.6434209s)
2025-10-27T13:33:41.1651175Z 13:33:41 [DBG] [xUnit.net 00:10:10.86] Datadog.Trace.ClrProfiler.IntegrationTests: STARTED: Datadog.Trace.ClrProfiler.IntegrationTests.AerospikeTests.SubmitTraces(4.3.1, v1)
2025-10-27T13:33:41.1732740Z 13:33:41 [ERR] [xUnit.net 00:10:10.86]     Datadog.Trace.ClrProfiler.IntegrationTests.AerospikeTests.SubmitTraces(packageVersion: "5.4.1", metadataSchemaVersion: "v0") [FAIL]
2025-10-27T13:33:42.6667078Z 13:33:42 [DBG]   Failed Datadog.Trace.ClrProfiler.IntegrationTests.AerospikeTests.SubmitTraces(packageVersion: "5.4.1", metadataSchemaVersion: "v0") [17 s]
2025-10-27T13:33:42.6667493Z 13:33:42 [DBG]   Error Message:
2025-10-27T13:33:42.6667956Z 13:33:42 [DBG]    Datadog.Trace.TestHelpers.ExitCodeException+SIGABRTExitCodeException : Expected exit code: 0, actual exit code: 134.
2025-10-27T13:33:42.6668207Z 13:33:42 [DBG]   Stack Trace:
2025-10-27T13:33:42.6668512Z 13:33:42 [DBG]      at Datadog.Trace.TestHelpers.ExitCodeException.Throw(Int32 actualExitCode, Int32 expectedExitCode, String message) in /project/tracer/test/Datadog.Trace.TestHelpers/ExitCodeException.cs:line 44
2025-10-27T13:33:42.6668925Z 13:33:42 [DBG]    at Datadog.Trace.TestHelpers.TestHelper.WaitForProcessResult(ProcessHelper helper, Int32 expectedExitCode, Boolean dumpChildProcesses) in /project/tracer/test/Datadog.Trace.TestHelpers.AutoInstrumentation/TestHelper.cs:line 202
2025-10-27T13:33:42.6669423Z 13:33:42 [DBG]    at Datadog.Trace.TestHelpers.TestHelper.RunSampleAndWaitForExit(MockTracerAgent agent, String arguments, String packageVersion, String framework, Int32 aspNetCorePort, Boolean usePublishWithRID, String dotnetRuntimeArgs) in /project/tracer/test/Datadog.Trace.TestHelpers.AutoInstrumentation/TestHelper.cs:line 173
2025-10-27T13:33:42.6670002Z 13:33:42 [DBG]    at Datadog.Trace.ClrProfiler.IntegrationTests.AerospikeTests.SubmitTraces(String packageVersion, String metadataSchemaVersion) in /project/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AerospikeTests.cs:line 51
2025-10-27T13:33:42.6670343Z 13:33:42 [DBG] --- End of stack trace from previous location where exception was thrown ---
2025-10-27T13:33:42.6670570Z 13:33:42 [DBG]   Standard Output Messages:
2025-10-27T13:33:42.6670764Z 13:33:42 [DBG]  Platform: X64
2025-10-27T13:33:42.6670997Z 13:33:42 [DBG]  TargetPlatform: X64
2025-10-27T13:33:42.6671199Z 13:33:42 [DBG]  Configuration: Release
2025-10-27T13:33:42.6671421Z 13:33:42 [DBG]  TargetFramework: netcoreapp3.1
2025-10-27T13:33:42.6671617Z 13:33:42 [DBG]  .NET Core: True
2025-10-27T13:33:42.6671852Z 13:33:42 [DBG]  Native Loader DLL: /project/shared/bin/monitoring-home/linux-musl-x64/Datadog.Trace.ClrProfiler.Native.so
2025-10-27T13:33:42.6672106Z 13:33:42 [DBG]  Agent listener info: Traces at port 41929
2025-10-27T13:33:42.6672376Z 13:33:42 [DBG]  Starting Application: /project/artifacts/publish/Samples.Aerospike/release_netcoreapp3.1_5.4.1/Samples.Aerospike.dll
2025-10-27T13:33:42.6672618Z 13:33:42 [DBG]  ProcessId: 6808
2025-10-27T13:33:42.6672804Z 13:33:42 [DBG]  StandardOutput:
2025-10-27T13:33:42.6673001Z 13:33:42 [DBG]  Writing full dump to file /tmp/coredump.6808
2025-10-27T13:33:42.6673223Z 13:33:42 [DBG]  Written 194633728 bytes (47518 pages) to core file
2025-10-27T13:33:42.6673420Z 13:33:42 [DBG]  
2025-10-27T13:33:42.6673682Z 13:33:42 [DBG]  StandardError:
2025-10-27T13:33:42.6673964Z 13:33:42 [DBG]  Unhandled exception. Aerospike.Client.AerospikeException+Timeout: Client timeout: iteration=1 socket=30000 total=1000 maxRetries=0 node=BB95FC0D312DF0A 172.17.0.1 32769 inDoubt=True
2025-10-27T13:33:42.6674338Z 13:33:42 [DBG]     at Samples.Aerospike.Program.Main(String[] args) in D:\a\_work\1\s\tracer\test\test-applications\integrations\Samples.Aerospike\Program.cs:line 70
2025-10-27T13:33:42.6674633Z 13:33:42 [DBG]     at Samples.Aerospike.Program.<Main>(String[] args)
2025-10-27T13:33:42.6674891Z 13:33:42 [DBG]  
2025-10-27T13:33:42.6675512Z 13:33:42 [DBG]  ProcessId: 6808
2025-10-27T13:33:42.6675876Z 13:33:42 [DBG]  Exit Code: 134
2025-10-27T13:33:42.6676207Z 13:33:42 [DBG] 

Even though we were setting a timeout in the sample, the timeout was not correctly applied.

  • new AsyncClientPolicy { timeout = 10_000 } is a client-level knob. It does not override the per-operation timeouts.
  • Each Aerospike operation we call with a null policy uses the client’s default op policies (readPolicyDefault, writePolicyDefault, batchPolicyDefault, queryPolicyDefault, …).
  • Those defaults ship with totalTimeout = 1000 ms and maxRetries = 0. That’s what our exception shows: total=1000, iteration=1, maxRetries=0.

New default policies have been defined to apply timeouts.

A small fix was done to fix the Add operation. We were using strings for the add operation instead of numbers. While this did not trigger an error in our code, it was causing a server error. the Add method in the Aerospike C# client is fire-and-forget in style unless you actually inspect the Task or catch exceptions from it.

A using statement was added to close the results.

Reason for change

Implementation details

Test coverage

Other details

@github-actions github-actions bot added the area:tests unit tests, integration tests label Nov 3, 2025
@dd-trace-dotnet-ci-bot
Copy link

dd-trace-dotnet-ci-bot bot commented Nov 3, 2025

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.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7751) - mean (72ms)  : 71, 73
     .   : milestone, 72,
    master - mean (72ms)  : 71, 73
     .   : milestone, 72,

    section Baseline
    This PR (7751) - mean (68ms)  : 67, 70
     .   : milestone, 68,
    master - mean (68ms)  : 67, 69
     .   : milestone, 68,

    section CallTarget+Inlining+NGEN
    This PR (7751) - mean (1,044ms)  : 1016, 1072
     .   : milestone, 1044,
    master - mean (1,043ms)  : 1006, 1081
     .   : milestone, 1043,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7751) - mean (107ms)  : 105, 108
     .   : milestone, 107,
    master - mean (106ms)  : 105, 107
     .   : milestone, 106,

    section Baseline
    This PR (7751) - mean (106ms)  : 104, 108
     .   : milestone, 106,
    master - mean (105ms)  : 103, 108
     .   : milestone, 105,

    section CallTarget+Inlining+NGEN
    This PR (7751) - mean (749ms)  : 721, 776
     .   : milestone, 749,
    master - mean (748ms)  : 724, 772
     .   : milestone, 748,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7751) - mean (94ms)  : 93, 95
     .   : milestone, 94,
    master - mean (94ms)  : 93, 95
     .   : milestone, 94,

    section Baseline
    This PR (7751) - mean (94ms)  : 91, 96
     .   : milestone, 94,
    master - mean (93ms)  : 91, 95
     .   : milestone, 93,

    section CallTarget+Inlining+NGEN
    This PR (7751) - mean (700ms)  : 679, 722
     .   : milestone, 700,
    master - mean (707ms)  : 670, 744
     .   : milestone, 707,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7751) - mean (93ms)  : 92, 94
     .   : milestone, 93,
    master - mean (92ms)  : 91, 94
     .   : milestone, 92,

    section Baseline
    This PR (7751) - mean (92ms)  : 90, 94
     .   : milestone, 92,
    master - mean (92ms)  : 89, 94
     .   : milestone, 92,

    section CallTarget+Inlining+NGEN
    This PR (7751) - mean (661ms)  : 646, 675
     .   : milestone, 661,
    master - mean (661ms)  : 646, 675
     .   : milestone, 661,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7751) - mean (197ms)  : 194, 200
     .   : milestone, 197,
    master - mean (194ms)  : 191, 197
     .   : milestone, 194,

    section Baseline
    This PR (7751) - mean (195ms)  : 188, 202
     .   : milestone, 195,
    master - mean (191ms)  : 187, 194
     .   : milestone, 191,

    section CallTarget+Inlining+NGEN
    This PR (7751) - mean (1,173ms)  : 1101, 1244
     .   : milestone, 1173,
    master - mean (1,157ms)  : 1098, 1216
     .   : milestone, 1157,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7751) - mean (277ms)  : 272, 283
     .   : milestone, 277,
    master - mean (274ms)  : 270, 277
     .   : milestone, 274,

    section Baseline
    This PR (7751) - mean (278ms)  : 272, 285
     .   : milestone, 278,
    master - mean (274ms)  : 269, 279
     .   : milestone, 274,

    section CallTarget+Inlining+NGEN
    This PR (7751) - mean (952ms)  : 900, 1004
     .   : milestone, 952,
    master - mean (944ms)  : 902, 986
     .   : milestone, 944,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7751) - mean (279ms)  : 268, 289
     .   : milestone, 279,
    master - mean (269ms)  : 264, 273
     .   : milestone, 269,

    section Baseline
    This PR (7751) - mean (272ms)  : 265, 280
     .   : milestone, 272,
    master - mean (266ms)  : 262, 270
     .   : milestone, 266,

    section CallTarget+Inlining+NGEN
    This PR (7751) - mean (938ms)  : 885, 992
     .   : milestone, 938,
    master - mean (924ms)  : 874, 974
     .   : milestone, 924,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7751) - mean (275ms)  : 264, 286
     .   : milestone, 275,
    master - mean (265ms)  : 261, 269
     .   : milestone, 265,

    section Baseline
    This PR (7751) - mean (274ms)  : 261, 287
     .   : milestone, 274,
    master - mean (265ms)  : 261, 270
     .   : milestone, 265,

    section CallTarget+Inlining+NGEN
    This PR (7751) - mean (857ms)  : 836, 879
     .   : milestone, 857,
    master - mean (850ms)  : 831, 868
     .   : milestone, 850,

Loading

@pr-commenter
Copy link

pr-commenter bot commented Nov 3, 2025

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #7751 compared to master:

  • 2 benchmarks are faster, with geometric mean 2.376
  • 1 benchmarks are slower, with geometric mean 2.437
  • 13 benchmarks have fewer allocations
  • 1 benchmarks have more 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 ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #7751

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472 6.1 KB 6 KB -100 B -1.64%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 10.4μs 58.6ns 397ns 0 0 0 5.53 KB
master StartStopWithChild netcoreapp3.1 14.4μs 65.8ns 255ns 0 0 0 5.7 KB
master StartStopWithChild net472 22μs 55.5ns 200ns 0.888 0.222 0 6.1 KB
#7751 StartStopWithChild net6.0 10.7μs 57.4ns 325ns 0 0 0 5.52 KB
#7751 StartStopWithChild netcoreapp3.1 14.1μs 53.1ns 206ns 0 0 0 5.71 KB
#7751 StartStopWithChild net472 22.2μs 119ns 662ns 0.909 0.114 0 6 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 947μs 302ns 1.17μs 0 0 0 2.71 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.02ms 61.3ns 212ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.2ms 238ns 890ns 0 0 0 3.35 KB
#7751 WriteAndFlushEnrichedTraces net6.0 931μs 293ns 1.1μs 0 0 0 2.71 KB
#7751 WriteAndFlushEnrichedTraces netcoreapp3.1 1.04ms 159ns 594ns 0 0 0 2.7 KB
#7751 WriteAndFlushEnrichedTraces net472 1.2ms 217ns 839ns 0 0 0 3.35 KB
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Unknown 🤷 Fewer allocations 🎉

Fewer allocations 🎉 in #7751

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑net6.0 1.22 KB 0 b -1.22 KB -100.00%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑netcoreapp3.1 1.2 KB 0 b -1.2 KB -100.00%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑net472 1.23 KB 0 b -1.23 KB -100.00%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody‑net6.0 4.72 KB 0 b -4.72 KB -100.00%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody‑netcoreapp3.1 4.62 KB 0 b -4.62 KB -100.00%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody‑net472 4.74 KB 0 b -4.74 KB -100.00%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 1.08μs 5.97ns 38.2ns 0 0 0 1.22 KB
master AllCycleSimpleBody netcoreapp3.1 1.43μs 6.95ns 28.6ns 0 0 0 1.2 KB
master AllCycleSimpleBody net472 1.07μs 0.276ns 1.03ns 0.192 0 0 1.23 KB
master AllCycleMoreComplexBody net6.0 7.15μs 35.3ns 162ns 0 0 0 4.72 KB
master AllCycleMoreComplexBody netcoreapp3.1 8.97μs 2.02ns 7.3ns 0 0 0 4.62 KB
master AllCycleMoreComplexBody net472 7.69μs 3.92ns 15.2ns 0.73 0 0 4.74 KB
master ObjectExtractorSimpleBody net6.0 316ns 1.76ns 11.4ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 399ns 1.42ns 5.51ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 297ns 0.0403ns 0.151ns 0.0433 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.24μs 27.9ns 108ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.88μs 27.1ns 105ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.63μs 1.48ns 5.75ns 0.597 0 0 3.8 KB
#7751 AllCycleSimpleBody net6.0 N/A N/A N/A NaN NaN NaN 0 b
#7751 AllCycleSimpleBody netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
#7751 AllCycleSimpleBody net472 N/A N/A N/A NaN NaN NaN 0 b
#7751 AllCycleMoreComplexBody net6.0 N/A N/A N/A NaN NaN NaN 0 b
#7751 AllCycleMoreComplexBody netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
#7751 AllCycleMoreComplexBody net472 N/A N/A N/A NaN NaN NaN 0 b
#7751 ObjectExtractorSimpleBody net6.0 316ns 0.11ns 0.413ns 0 0 0 280 B
#7751 ObjectExtractorSimpleBody netcoreapp3.1 403ns 2.07ns 10.1ns 0 0 0 272 B
#7751 ObjectExtractorSimpleBody net472 296ns 0.0381ns 0.142ns 0.0446 0 0 281 B
#7751 ObjectExtractorMoreComplexBody net6.0 6.31μs 4.95ns 19.2ns 0 0 0 3.78 KB
#7751 ObjectExtractorMoreComplexBody netcoreapp3.1 7.8μs 7.53ns 29.2ns 0 0 0 3.69 KB
#7751 ObjectExtractorMoreComplexBody net472 6.68μs 7.49ns 26ns 0.572 0 0 3.8 KB
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EncodeArgs net6.0 77.1μs 39.9ns 149ns 0 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 98μs 295ns 1.14μs 0 0 0 32.4 KB
master EncodeArgs net472 112μs 24.3ns 94ns 5.07 0 0 32.51 KB
master EncodeLegacyArgs net6.0 142μs 63.9ns 248ns 0 0 0 2.15 KB
master EncodeLegacyArgs netcoreapp3.1 199μs 593ns 2.3μs 0 0 0 2.14 KB
master EncodeLegacyArgs net472 263μs 60.8ns 235ns 0 0 0 2.16 KB
#7751 EncodeArgs net6.0 78.9μs 36.6ns 142ns 0 0 0 32.4 KB
#7751 EncodeArgs netcoreapp3.1 98μs 222ns 861ns 0 0 0 32.4 KB
#7751 EncodeArgs net472 110μs 13.7ns 51.2ns 4.95 0 0 32.51 KB
#7751 EncodeLegacyArgs net6.0 144μs 150ns 579ns 0 0 0 2.15 KB
#7751 EncodeLegacyArgs netcoreapp3.1 198μs 139ns 521ns 0 0 0 2.14 KB
#7751 EncodeLegacyArgs net472 265μs 17.4ns 62.6ns 0 0 0 2.16 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #7751

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑netcoreapp3.1 2.437 296,834.23 723,316.46

Faster 🎉 in #7751

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑netcoreapp3.1 2.060 850,268.54 412,834.06

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 390μs 68.5ns 247ns 0 0 0 4.55 KB
master RunWafRealisticBenchmark netcoreapp3.1 847μs 3.96μs 15.3μs 0 0 0 4.48 KB
master RunWafRealisticBenchmark net472 428μs 66.1ns 256ns 0 0 0 4.66 KB
master RunWafRealisticBenchmarkWithAttack net6.0 290μs 168ns 652ns 0 0 0 2.24 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 297μs 139ns 501ns 0 0 0 2.22 KB
master RunWafRealisticBenchmarkWithAttack net472 308μs 43.4ns 168ns 0 0 0 2.29 KB
#7751 RunWafRealisticBenchmark net6.0 396μs 97.8ns 379ns 0 0 0 4.55 KB
#7751 RunWafRealisticBenchmark netcoreapp3.1 413μs 163ns 611ns 0 0 0 4.48 KB
#7751 RunWafRealisticBenchmark net472 427μs 38.1ns 148ns 0 0 0 4.66 KB
#7751 RunWafRealisticBenchmarkWithAttack net6.0 285μs 37.8ns 146ns 0 0 0 2.24 KB
#7751 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 662μs 14.8μs 138μs 0 0 0 2.22 KB
#7751 RunWafRealisticBenchmarkWithAttack net472 311μs 18.9ns 68.3ns 0 0 0 2.29 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 61.8μs 40.7ns 147ns 0 0 0 14.52 KB
master SendRequest netcoreapp3.1 72.5μs 133ns 461ns 0 0 0 17.42 KB
master SendRequest net472 0.00254ns 0.00127ns 0.00492ns 0 0 0 0 b
#7751 SendRequest net6.0 61.5μs 79.8ns 298ns 0 0 0 14.52 KB
#7751 SendRequest netcoreapp3.1 72μs 83.2ns 300ns 0 0 0 17.42 KB
#7751 SendRequest net472 0.00345ns 0.00149ns 0.00579ns 0 0 0 0 b
Benchmarks.Trace.CharSliceBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #7751

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 4 B 2 B -2 B -50.00%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net472 73 B 0 b -73 B -100.00%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net472 47 B 0 b -47 B -100.00%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master OriginalCharSlice net6.0 1.89ms 6.5μs 25.2μs 0 0 0 640 KB
master OriginalCharSlice netcoreapp3.1 2.15ms 8.71μs 33.7μs 0 0 0 640 KB
master OriginalCharSlice net472 2.64ms 145ns 541ns 100 0 0 641.95 KB
master OptimizedCharSlice net6.0 1.45ms 93.1ns 348ns 0 0 0 7 B
master OptimizedCharSlice netcoreapp3.1 1.8ms 238ns 921ns 0 0 0 1 B
master OptimizedCharSlice net472 1.95ms 459ns 1.78μs 0 0 0 73 B
master OptimizedCharSliceWithPool net6.0 851μs 77ns 298ns 0 0 0 4 B
master OptimizedCharSliceWithPool netcoreapp3.1 798μs 85.8ns 332ns 0 0 0 0 b
master OptimizedCharSliceWithPool net472 1.14ms 106ns 409ns 0 0 0 47 B
#7751 OriginalCharSlice net6.0 1.98ms 2.04μs 7.62μs 0 0 0 640.01 KB
#7751 OriginalCharSlice netcoreapp3.1 2.1ms 9.96μs 38.6μs 0 0 0 640 KB
#7751 OriginalCharSlice net472 2.65ms 331ns 1.2μs 100 0 0 641.95 KB
#7751 OptimizedCharSlice net6.0 1.35ms 311ns 1.16μs 0 0 0 7 B
#7751 OptimizedCharSlice netcoreapp3.1 1.65ms 184ns 664ns 0 0 0 1 B
#7751 OptimizedCharSlice net472 1.93ms 471ns 1.82μs 0 0 0 0 b
#7751 OptimizedCharSliceWithPool net6.0 804μs 46.9ns 182ns 0 0 0 2 B
#7751 OptimizedCharSliceWithPool netcoreapp3.1 835μs 223ns 865ns 0 0 0 0 b
#7751 OptimizedCharSliceWithPool net472 1.22ms 64.5ns 250ns 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 671μs 1.99μs 7.69μs 0 0 0 41.74 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 735μs 942ns 3.4μs 0 0 0 42.01 KB
master WriteAndFlushEnrichedTraces net472 898μs 4.33μs 16.8μs 8.33 0 0 55.95 KB
#7751 WriteAndFlushEnrichedTraces net6.0 651μs 676ns 2.62μs 0 0 0 41.91 KB
#7751 WriteAndFlushEnrichedTraces netcoreapp3.1 686μs 3.75μs 21.2μs 0 0 0 42.05 KB
#7751 WriteAndFlushEnrichedTraces net472 833μs 3.99μs 16.9μs 4.46 0 0 55.94 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.92μs 9.95ns 45.6ns 0 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 2.62μs 12.5ns 48.3ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.9μs 5.92ns 22.9ns 0.146 0.0146 0 987 B
#7751 ExecuteNonQuery net6.0 1.9μs 6.81ns 26.4ns 0 0 0 1.02 KB
#7751 ExecuteNonQuery netcoreapp3.1 2.65μs 3.7ns 14.3ns 0 0 0 1.02 KB
#7751 ExecuteNonQuery net472 2.9μs 5.97ns 23.1ns 0.145 0.0145 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.66μs 8.56ns 40.2ns 0 0 0 1.03 KB
master CallElasticsearch netcoreapp3.1 2.21μs 8.77ns 34ns 0 0 0 1.03 KB
master CallElasticsearch net472 3.58μs 2.11ns 7.9ns 0.161 0 0 1.04 KB
master CallElasticsearchAsync net6.0 1.84μs 7.13ns 27.6ns 0 0 0 1.01 KB
master CallElasticsearchAsync netcoreapp3.1 2.39μs 11.7ns 48.4ns 0 0 0 1.08 KB
master CallElasticsearchAsync net472 3.66μs 3.58ns 12.9ns 0.165 0 0 1.1 KB
#7751 CallElasticsearch net6.0 1.69μs 9.18ns 49.5ns 0 0 0 1.03 KB
#7751 CallElasticsearch netcoreapp3.1 2.2μs 2.52ns 9.75ns 0 0 0 1.03 KB
#7751 CallElasticsearch net472 3.65μs 3.5ns 13.5ns 0.163 0 0 1.04 KB
#7751 CallElasticsearchAsync net6.0 1.88μs 7.93ns 30.7ns 0 0 0 1.01 KB
#7751 CallElasticsearchAsync netcoreapp3.1 2.33μs 11.6ns 47.7ns 0 0 0 1.08 KB
#7751 CallElasticsearchAsync net472 3.64μs 1.17ns 4.52ns 0.163 0 0 1.1 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.88μs 8.7ns 34.8ns 0 0 0 952 B
master ExecuteAsync netcoreapp3.1 2.45μs 8.02ns 31.1ns 0 0 0 952 B
master ExecuteAsync net472 2.57μs 4.84ns 18.7ns 0.14 0 0 915 B
#7751 ExecuteAsync net6.0 1.87μs 0.588ns 2.28ns 0 0 0 952 B
#7751 ExecuteAsync netcoreapp3.1 2.41μs 7.46ns 28.9ns 0 0 0 952 B
#7751 ExecuteAsync net472 2.58μs 2.83ns 10.6ns 0.142 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 7.12μs 26.2ns 97.9ns 0 0 0 2.36 KB
master SendAsync netcoreapp3.1 8.49μs 7.15ns 27.7ns 0 0 0 2.9 KB
master SendAsync net472 12.6μs 16.7ns 64.7ns 0.505 0 0 3.18 KB
#7751 SendAsync net6.0 7.17μs 8.8ns 31.7ns 0 0 0 2.36 KB
#7751 SendAsync netcoreapp3.1 8.73μs 22.3ns 86.3ns 0 0 0 2.9 KB
#7751 SendAsync net472 12.1μs 11.4ns 44.1ns 0.483 0 0 3.18 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Faster 🎉 More allocations ⚠️

Faster 🎉 in #7751

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 2.742 1,399,850.00 510,550.00

More allocations ⚠️ in #7751

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1 43.15 KB 43.44 KB 288 B 0.67%

Fewer allocations 🎉 in #7751

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 286.74 KB 260.25 KB -26.49 KB -9.24%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 65.54 KB 57.34 KB -8.19 KB -12.50%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 338.03 KB 247 KB -91.03 KB -26.93%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 46.1μs 262ns 2μs 0 0 0 46.48 KB
master StringConcatBenchmark netcoreapp3.1 57.5μs 921ns 9.16μs 0 0 0 43.15 KB
master StringConcatBenchmark net472 56.7μs 248ns 961ns 0 0 0 65.54 KB
master StringConcatAspectBenchmark net6.0 472μs 2.36μs 10.6μs 0 0 0 286.74 KB
master StringConcatAspectBenchmark netcoreapp3.1 1.4ms 2.45μs 9.49μs 0 0 0 338.03 KB
master StringConcatAspectBenchmark net472 409μs 2.28μs 13.9μs 0 0 0 278.05 KB
#7751 StringConcatBenchmark net6.0 41.1μs 195ns 1.07μs 0 0 0 46.42 KB
#7751 StringConcatBenchmark netcoreapp3.1 49.1μs 280ns 2.02μs 0 0 0 43.44 KB
#7751 StringConcatBenchmark net472 57.8μs 136ns 508ns 0 0 0 57.34 KB
#7751 StringConcatAspectBenchmark net6.0 445μs 1.13μs 3.9μs 0 0 0 260.25 KB
#7751 StringConcatAspectBenchmark netcoreapp3.1 511μs 2.3μs 7.98μs 0 0 0 247 KB
#7751 StringConcatAspectBenchmark net472 404μs 2.3μs 15.9μs 0 0 0 278.53 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 2.6μs 0.902ns 3.49ns 0 0 0 1.7 KB
master EnrichedLog netcoreapp3.1 3.66μs 17.7ns 77.3ns 0 0 0 1.7 KB
master EnrichedLog net472 4μs 4.97ns 19.3ns 0.259 0 0 1.64 KB
#7751 EnrichedLog net6.0 2.65μs 2.2ns 8.53ns 0 0 0 1.7 KB
#7751 EnrichedLog netcoreapp3.1 3.72μs 17.4ns 67.5ns 0 0 0 1.7 KB
#7751 EnrichedLog net472 4.01μs 6.71ns 26ns 0.241 0 0 1.64 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 122μs 87.6ns 339ns 0 0 0 4.31 KB
master EnrichedLog netcoreapp3.1 126μs 109ns 393ns 0 0 0 4.31 KB
master EnrichedLog net472 169μs 149ns 578ns 0 0 0 4.52 KB
#7751 EnrichedLog net6.0 132μs 577ns 2.23μs 0 0 0 4.31 KB
#7751 EnrichedLog netcoreapp3.1 131μs 709ns 4.01μs 0 0 0 4.31 KB
#7751 EnrichedLog net472 168μs 23.6ns 91.2ns 0 0 0 4.52 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 5.06μs 2.03ns 7.85ns 0 0 0 2.26 KB
master EnrichedLog netcoreapp3.1 6.78μs 13.1ns 50.9ns 0 0 0 2.26 KB
master EnrichedLog net472 7.54μs 9.05ns 35.1ns 0.3 0 0 2.08 KB
#7751 EnrichedLog net6.0 5μs 10.7ns 40ns 0 0 0 2.26 KB
#7751 EnrichedLog netcoreapp3.1 6.81μs 23.6ns 91.6ns 0 0 0 2.26 KB
#7751 EnrichedLog net472 7.55μs 7.24ns 28ns 0.3 0 0 2.08 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 2.11μs 2.19ns 8.48ns 0 0 0 1.2 KB
master SendReceive netcoreapp3.1 2.59μs 12.5ns 54.4ns 0 0 0 1.2 KB
master SendReceive net472 3.05μs 3.87ns 14.5ns 0.184 0 0 1.2 KB
#7751 SendReceive net6.0 1.98μs 0.889ns 3.44ns 0 0 0 1.2 KB
#7751 SendReceive netcoreapp3.1 2.67μs 13ns 53.7ns 0 0 0 1.2 KB
#7751 SendReceive net472 3.07μs 3.69ns 13.3ns 0.185 0 0 1.2 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 4.37μs 10.3ns 40ns 0 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 5.89μs 16.4ns 63.4ns 0 0 0 1.63 KB
master EnrichedLog net472 6.7μs 7.75ns 30ns 0.301 0 0 2.03 KB
#7751 EnrichedLog net6.0 4.28μs 12.9ns 48.2ns 0 0 0 1.58 KB
#7751 EnrichedLog netcoreapp3.1 5.53μs 21ns 81.2ns 0 0 0 1.63 KB
#7751 EnrichedLog net472 6.53μs 11.1ns 42.9ns 0.291 0 0 2.03 KB
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 778ns 3.63ns 14.5ns 0 0 0 576 B
master StartFinishSpan netcoreapp3.1 953ns 5.08ns 27.8ns 0 0 0 576 B
master StartFinishSpan net472 926ns 0.447ns 1.73ns 0.0878 0 0 578 B
master StartFinishScope net6.0 916ns 4.88ns 23.4ns 0 0 0 696 B
master StartFinishScope netcoreapp3.1 1.25μs 5.97ns 23.1ns 0 0 0 696 B
master StartFinishScope net472 1.11μs 0.851ns 3.29ns 0.0997 0 0 658 B
#7751 StartFinishSpan net6.0 771ns 4.16ns 21.6ns 0 0 0 576 B
#7751 StartFinishSpan netcoreapp3.1 969ns 4.03ns 15.6ns 0 0 0 576 B
#7751 StartFinishSpan net472 935ns 2.1ns 8.13ns 0.0897 0 0 578 B
#7751 StartFinishScope net6.0 962ns 4.8ns 19.8ns 0 0 0 696 B
#7751 StartFinishScope netcoreapp3.1 1.22μs 0.768ns 2.97ns 0 0 0 696 B
#7751 StartFinishScope net472 1.12μs 0.888ns 3.44ns 0.101 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 1.08μs 0.281ns 1.05ns 0 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 1.43μs 7.02ns 28.1ns 0 0 0 696 B
master RunOnMethodBegin net472 1.49μs 0.588ns 2.2ns 0.104 0 0 658 B
#7751 RunOnMethodBegin net6.0 1.08μs 4.55ns 17.6ns 0 0 0 696 B
#7751 RunOnMethodBegin netcoreapp3.1 1.41μs 6.96ns 31.9ns 0 0 0 696 B
#7751 RunOnMethodBegin net472 1.44μs 1.48ns 5.73ns 0.1 0 0 658 B

@NachoEchevarria NachoEchevarria marked this pull request as ready for review November 3, 2025 13:44
@NachoEchevarria NachoEchevarria requested review from a team as code owners November 3, 2025 13:44
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.

Thanks!

Comment on lines -37 to +39
var bin3 = new Bin("hello", "world");
var bin3 = new Bin("count", 5);
Copy link
Member

Choose a reason for hiding this comment

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

Why this change? Will this not break the snapshots?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It did not break the snapshots apparently. It's a pretty NIT change. The add method Add should receive a number instead of a string. While this did not trigger inmediatly an exception, the correct usage is with a number.

@NachoEchevarria
Copy link
Collaborator Author

Thanks for the feedback and reviews!

@NachoEchevarria NachoEchevarria merged commit fd80061 into master Nov 3, 2025
152 checks passed
@NachoEchevarria NachoEchevarria deleted the nacho/ImproveAerospikeSample branch November 3, 2025 16:15
@github-actions github-actions bot added this to the vNext-v3 milestone Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tests unit tests, integration tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants