Skip to content

Conversation

@NachoEchevarria
Copy link
Collaborator

@NachoEchevarria NachoEchevarria commented Nov 24, 2025

Summary of changes

We are getting the following error in our integration tests:

2025-11-21T04:47:15.5891593Z 04:47:15 [DBG]   Stack Trace:
2025-11-21T04:47:15.5892025Z 04:47:15 [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-11-21T04:47:15.5892326Z 04:47:15 [DBG]    at Datadog.Trace.TestHelpers.TestHelper.WaitForProcessResult(ProcessHelper helper, Int32 expectedExitCode, Boolean dumpChildProcesses) in /project/tracer/test/Datadog.Trace.TestHelpers.AutoInstrumentation/TestHelper.cs:line 212
2025-11-21T04:47:15.5892650Z 04:47:15 [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 172
2025-11-21T04:47:15.5893224Z 04:47:15 [DBG]    at Datadog.Trace.ClrProfiler.IntegrationTests.AdoNet.MicrosoftDataSqlClientTests.SubmitsTraces(String packageVersion, String metadataSchemaVersion, String propagation) in /project/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/MicrosoftDataSqlClientTests.cs:line 62
2025-11-21T04:47:15.5893396Z 04:47:15 [DBG] --- End of stack trace from previous location ---
2025-11-21T04:47:15.5893558Z 04:47:15 [DBG]   Standard Output Messages:
2025-11-21T04:47:15.5893704Z 04:47:15 [DBG]  Platform: Arm64
2025-11-21T04:47:15.5893857Z 04:47:15 [DBG]  TargetPlatform: ARM64
2025-11-21T04:47:15.5894007Z 04:47:15 [DBG]  Configuration: Release
2025-11-21T04:47:15.5894160Z 04:47:15 [DBG]  TargetFramework: net8.0
2025-11-21T04:47:15.5894453Z 04:47:15 [DBG]  .NET Core: True
2025-11-21T04:47:15.5894656Z 04:47:15 [DBG]  Native Loader DLL: /project/shared/bin/monitoring-home/linux-arm64/Datadog.Trace.ClrProfiler.Native.so
2025-11-21T04:47:15.5894828Z 04:47:15 [DBG]  Agent listener info: Traces at port 45159
2025-11-21T04:47:15.5895049Z 04:47:15 [DBG]  Starting Application: /project/artifacts/publish/Samples.Microsoft.Data.SqlClient/release_net8.0_6.1.3/Samples.Microsoft.Data.SqlClient.dll
2025-11-21T04:47:15.5895201Z 04:47:15 [DBG]  ProcessId: 6967
2025-11-21T04:47:15.5895347Z 04:47:15 [DBG]  StandardOutput:
2025-11-21T04:47:15.5895700Z 04:47:15 [DBG]  Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 35 - An internal exception was caught)
2025-11-21T04:47:15.5895896Z 04:47:15 [DBG]   ---> System.Net.Sockets.SocketException (00000005, 0xFFFDFFFF): Name or service not known
2025-11-21T04:47:15.5896124Z 04:47:15 [DBG]     at System.Net.Dns.GetHostEntryOrAddressesCore(String hostName, Boolean justAddresses, AddressFamily addressFamily, Nullable`1 startingTimestamp)
2025-11-21T04:47:15.5896315Z 04:47:15 [DBG]     at System.Net.Dns.GetHostAddresses(String hostNameOrAddress, AddressFamily family)
2025-11-21T04:47:15.5896553Z 04:47:15 [DBG]     at Microsoft.Data.SqlClient.ManagedSni.SniTcpHandle.GetHostAddressesSortedByPreference(String serverName, SqlConnectionIPAddressPreference ipPreference)+MoveNext()
2025-11-21T04:47:15.5896817Z 04:47:15 [DBG]     at Microsoft.Data.SqlClient.ManagedSni.SniTcpHandle.Connect(String serverName, Int32 port, TimeoutTimer timeout, SqlConnectionIPAddressPreference ipPreference, String cachedFQDN, SQLDNSInfo& pendingDNSInfo)
2025-11-21T04:47:15.5897128Z 04:47:15 [DBG]     at Microsoft.Data.SqlClient.ManagedSni.SniTcpHandle..ctor(String serverName, Int32 port, TimeoutTimer timeout, Boolean parallel, SqlConnectionIPAddressPreference ipPreference, String cachedFQDN, SQLDNSInfo& pendingDNSInfo, Boolean tlsFirst, String hostNameInCertificate, String serverCertificateFilename)
2025-11-21T04:47:15.5897354Z 04:47:15 [DBG]     at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
2025-11-21T04:47:15.5897591Z 04:47:15 [DBG]     at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, SqlCommand command, Boolean callerHasConnectionLock, Boolean asyncClose)
2025-11-21T04:47:15.5897851Z 04:47:15 [DBG]     at Microsoft.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, TimeoutTimer timeout, SqlConnectionString connectionOptions, Boolean withFailover)
2025-11-21T04:47:15.5898098Z 04:47:15 [DBG]     at Microsoft.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, TimeoutTimer timeout, Boolean withFailover)
2025-11-21T04:47:15.5898394Z 04:47:15 [DBG]     at Microsoft.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
2025-11-21T04:47:15.5898801Z 04:47:15 [DBG]     at Microsoft.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
2025-11-21T04:47:15.5899380Z 04:47:15 [DBG]     at Microsoft.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String access***, IDbConnectionPool pool, Func`3 access***Callback)
2025-11-21T04:47:15.5899800Z 04:47:15 [DBG]     at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionPoolGroupProviderInfo poolGroupProviderInfo, IDbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
2025-11-21T04:47:15.5900076Z 04:47:15 [DBG]     at Microsoft.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(IDbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
2025-11-21T04:47:15.5900319Z 04:47:15 [DBG]     at Microsoft.Data.SqlClient.ConnectionPool.WaitHandleDbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
2025-11-21T04:47:15.5900568Z 04:47:15 [DBG]     at Microsoft.Data.SqlClient.ConnectionPool.WaitHandleDbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
2025-11-21T04:47:15.5900866Z 04:47:15 [DBG]     at Microsoft.Data.SqlClient.ConnectionPool.WaitHandleDbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
2025-11-21T04:47:15.5901142Z 04:47:15 [DBG]     at Microsoft.Data.SqlClient.ConnectionPool.WaitHandleDbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 taskCompletionSource, DbConnectionOptions userOptions, DbConnectionInternal& connection)
2025-11-21T04:47:15.5901419Z 04:47:15 [DBG]     at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
2025-11-21T04:47:15.5901688Z 04:47:15 [DBG]     at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
2025-11-21T04:47:15.5902144Z 04:47:15 [DBG]     at Microsoft.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
2025-11-21T04:47:15.5902394Z 04:47:15 [DBG]     at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides)
2025-11-21T04:47:15.5902583Z 04:47:15 [DBG]     at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides)
2025-11-21T04:47:15.5902754Z 04:47:15 [DBG]     at Microsoft.Data.SqlClient.SqlConnection.Open()
2025-11-21T04:47:15.5903048Z 04:47:15 [DBG]     at Samples.Microsoft.Data.SqlClient.Program.OpenConnection(Type connectionType) in D:\a\_work\1\s\tracer\test\test-applications\integrations\Samples.Microsoft.Data.SqlClient\Program.cs:line 49

CI tests occasionally fail with DNS/network errors (Error 11001, Class 20) when SQL Server isn't immediately available. These are infrastructure issues, not test failures. By catching connection errors and returning exit code 13, the test framework can skip these tests instead of failing the build.

SQL exceptions during test execution (after successful connection) will still fail the test as expected.

Changes

  • Catch SqlException during connection attempts in Samples.Microsoft.Data.SqlClient
  • Exit with code 13 (skip) when SQL Server is unavailable after 3 retry attempts
  • Refactor retry logic from goto to a clean for loop
  • Improve logging to show attempt progress and detailed error information
  • Add some sleep time between tries

Reason for change

Implementation details

Test coverage

Other details

@github-actions github-actions bot added the area:tests unit tests, integration tests label Nov 24, 2025
@NachoEchevarria NachoEchevarria changed the title Exit code 13 Avoid SQL connection flakines in integration tests Nov 24, 2025
@dd-trace-dotnet-ci-bot
Copy link

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

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (7854) and master.

✅ No regressions detected - check the details below

Full Metrics Comparison

FakeDbCommand

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration76.78 ± (76.41 - 77.15) ms75.05 ± (75.03 - 75.70) ms-2.2%
.NET Framework 4.8 - Bailout
duration79.01 ± (78.98 - 79.74) ms80.03 ± (80.03 - 80.80) ms+1.3%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1049.83 ± (1055.45 - 1066.15) ms1062.97 ± (1069.16 - 1081.55) ms+1.3%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms23.22 ± (23.13 - 23.30) ms23.00 ± (22.92 - 23.08) ms-0.9%
process.time_to_main_ms88.30 ± (87.93 - 88.66) ms88.31 ± (87.96 - 88.66) ms+0.0%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.91 ± (10.91 - 10.91) MB10.95 ± (10.94 - 10.95) MB+0.3%✅⬆️
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.87 ± (22.81 - 22.92) ms22.67 ± (22.61 - 22.73) ms-0.8%
process.time_to_main_ms88.28 ± (87.95 - 88.61) ms88.90 ± (88.52 - 89.29) ms+0.7%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.95 ± (10.95 - 10.95) MB10.99 ± (10.99 - 11.00) MB+0.4%✅⬆️
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms222.75 ± (220.67 - 224.82) ms224.92 ± (222.54 - 227.30) ms+1.0%✅⬆️
process.time_to_main_ms497.99 ± (496.96 - 499.02) ms498.45 ± (497.41 - 499.50) ms+0.1%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed47.84 ± (47.82 - 47.86) MB47.81 ± (47.79 - 47.83) MB-0.1%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.5%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms21.84 ± (21.78 - 21.90) ms21.63 ± (21.56 - 21.70) ms-1.0%
process.time_to_main_ms76.39 ± (76.09 - 76.69) ms75.74 ± (75.43 - 76.06) ms-0.8%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.60 ± (10.59 - 10.60) MB10.66 ± (10.65 - 10.66) MB+0.5%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.68 ± (21.62 - 21.74) ms21.53 ± (21.46 - 21.59) ms-0.7%
process.time_to_main_ms77.45 ± (77.18 - 77.72) ms76.97 ± (76.62 - 77.33) ms-0.6%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.68 ± (10.67 - 10.68) MB10.69 ± (10.69 - 10.69) MB+0.1%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms209.24 ± (207.97 - 210.51) ms216.57 ± (213.43 - 219.70) ms+3.5%✅⬆️
process.time_to_main_ms468.88 ± (467.90 - 469.85) ms467.69 ± (466.68 - 468.69) ms-0.3%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.12 ± (48.10 - 48.15) MB48.09 ± (48.06 - 48.12) MB-0.1%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.0%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms19.94 ± (19.86 - 20.02) ms19.90 ± (19.84 - 19.96) ms-0.2%
process.time_to_main_ms74.90 ± (74.52 - 75.29) ms75.09 ± (74.78 - 75.40) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.66 ± (7.65 - 7.67) MB7.67 ± (7.67 - 7.68) MB+0.2%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.98 ± (19.93 - 20.04) ms19.89 ± (19.83 - 19.95) ms-0.5%
process.time_to_main_ms76.52 ± (76.23 - 76.81) ms76.46 ± (76.14 - 76.78) ms-0.1%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.71 ± (7.70 - 7.72) MB7.73 ± (7.73 - 7.74) MB+0.3%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms193.41 ± (192.48 - 194.34) ms192.00 ± (191.23 - 192.77) ms-0.7%
process.time_to_main_ms458.24 ± (457.32 - 459.16) ms453.85 ± (452.90 - 454.81) ms-1.0%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed36.48 ± (36.44 - 36.53) MB36.41 ± (36.38 - 36.45) MB-0.2%
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)+0.2%✅⬆️

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration193.09 ± (192.96 - 193.76) ms197.81 ± (197.93 - 198.79) ms+2.4%✅⬆️
.NET Framework 4.8 - Bailout
duration196.53 ± (196.52 - 197.10) ms201.86 ± (201.75 - 202.42) ms+2.7%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1111.45 ± (1118.20 - 1128.70) ms1147.36 ± (1147.47 - 1154.38) ms+3.2%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms188.47 ± (188.10 - 188.84) ms196.92 ± (196.45 - 197.38) ms+4.5%✅⬆️
process.time_to_main_ms81.01 ± (80.79 - 81.23) ms84.73 ± (84.48 - 84.97) ms+4.6%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.02 ± (16.00 - 16.05) MB16.00 ± (15.99 - 16.02) MB-0.1%
runtime.dotnet.threads.count20 ± (19 - 20)20 ± (20 - 20)+0.5%✅⬆️
.NET Core 3.1 - Bailout
process.internal_duration_ms187.74 ± (187.43 - 188.05) ms193.21 ± (192.81 - 193.60) ms+2.9%✅⬆️
process.time_to_main_ms81.98 ± (81.85 - 82.11) ms84.66 ± (84.45 - 84.87) ms+3.3%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.15 ± (16.11 - 16.18) MB16.13 ± (16.10 - 16.16) MB-0.1%
runtime.dotnet.threads.count21 ± (20 - 21)21 ± (21 - 21)+1.4%✅⬆️
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms409.92 ± (406.45 - 413.39) ms418.99 ± (416.25 - 421.73) ms+2.2%✅⬆️
process.time_to_main_ms470.48 ± (469.85 - 471.10) ms495.81 ± (494.36 - 497.26) ms+5.4%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed58.69 ± (58.57 - 58.81) MB58.94 ± (58.85 - 59.03) MB+0.4%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)-0.0%
.NET 6 - Baseline
process.internal_duration_ms193.04 ± (192.61 - 193.47) ms199.92 ± (199.41 - 200.44) ms+3.6%✅⬆️
process.time_to_main_ms70.11 ± (69.94 - 70.29) ms78.05 ± (77.73 - 78.36) ms+11.3%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.21 ± (16.08 - 16.33) MB16.58 ± (16.56 - 16.59) MB+2.3%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 19)19 ± (19 - 19)+4.8%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms191.68 ± (191.39 - 191.98) ms199.27 ± (198.63 - 199.92) ms+4.0%✅⬆️
process.time_to_main_ms70.79 ± (70.70 - 70.88) ms79.15 ± (78.87 - 79.43) ms+11.8%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.25 ± (16.11 - 16.39) MB16.61 ± (16.59 - 16.63) MB+2.2%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 20)20 ± (20 - 20)+5.1%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms411.39 ± (408.59 - 414.19) ms430.49 ± (427.81 - 433.17) ms+4.6%✅⬆️
process.time_to_main_ms442.16 ± (441.51 - 442.82) ms475.33 ± (474.13 - 476.53) ms+7.5%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed58.72 ± (58.57 - 58.87) MB59.51 ± (59.42 - 59.60) MB+1.3%✅⬆️
runtime.dotnet.threads.count30 ± (30 - 30)29 ± (29 - 29)-0.4%
.NET 8 - Baseline
process.internal_duration_ms190.45 ± (190.15 - 190.76) ms199.62 ± (198.98 - 200.25) ms+4.8%✅⬆️
process.time_to_main_ms69.66 ± (69.48 - 69.85) ms77.25 ± (76.91 - 77.58) ms+10.9%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.75 ± (11.73 - 11.78) MB11.99 ± (11.98 - 12.00) MB+2.0%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)19 ± (18 - 19)+1.9%✅⬆️
.NET 8 - Bailout
process.internal_duration_ms189.78 ± (189.50 - 190.06) ms197.08 ± (196.50 - 197.67) ms+3.8%✅⬆️
process.time_to_main_ms70.73 ± (70.61 - 70.84) ms76.81 ± (76.55 - 77.07) ms+8.6%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.82 ± (11.79 - 11.86) MB12.02 ± (12.01 - 12.04) MB+1.7%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+1.1%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms367.06 ± (365.63 - 368.49) ms378.51 ± (376.87 - 380.14) ms+3.1%✅⬆️
process.time_to_main_ms432.28 ± (431.59 - 432.97) ms455.01 ± (453.84 - 456.18) ms+5.3%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed47.92 ± (47.89 - 47.95) MB48.40 ± (48.26 - 48.53) MB+1.0%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)-1.1%
Comparison explanation

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 highlighted 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).

Duration charts
FakeDbCommand (.NET Framework 4.8)
gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7854) - mean (75ms)  : 71, 80
    master - mean (77ms)  : 71, 82

    section Bailout
    This PR (7854) - mean (80ms)  : 75, 86
    master - mean (79ms)  : 73, 85

    section CallTarget+Inlining+NGEN
    This PR (7854) - mean (1,075ms)  : 979, 1172
    master - mean (1,061ms)  : 983, 1138

Loading
FakeDbCommand (.NET Core 3.1)
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7854) - mean (119ms)  : 113, 125
    master - mean (119ms)  : 113, 125

    section Bailout
    This PR (7854) - mean (119ms)  : 112, 126
    master - mean (119ms)  : 111, 126

    section CallTarget+Inlining+NGEN
    This PR (7854) - mean (769ms)  : 716, 823
    master - mean (763ms)  : 707, 819

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7854) - mean (105ms)  : 97, 112
    master - mean (105ms)  : 100, 110

    section Bailout
    This PR (7854) - mean (105ms)  : 99, 111
    master - mean (106ms)  : 100, 111

    section CallTarget+Inlining+NGEN
    This PR (7854) - mean (730ms)  : 674, 786
    master - mean (708ms)  : 671, 745

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7854) - mean (104ms)  : 97, 110
    master - mean (103ms)  : 95, 111

    section Bailout
    This PR (7854) - mean (105ms)  : 98, 112
    master - mean (105ms)  : 99, 111

    section CallTarget+Inlining+NGEN
    This PR (7854) - mean (689ms)  : 666, 712
    master - mean (690ms)  : 658, 721

Loading
HttpMessageHandler (.NET Framework 4.8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7854) - mean (198ms)  : 194, 203
    master - mean (193ms)  : 189, 197

    section Bailout
    This PR (7854) - mean (202ms)  : 199, 205
    master - mean (197ms)  : 194, 200

    section CallTarget+Inlining+NGEN
    This PR (7854) - mean (1,151ms)  : 1101, 1201
    master - mean (1,123ms)  : 1049, 1198

Loading
HttpMessageHandler (.NET Core 3.1)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7854) - mean (291ms)  : 280, 302
    master - mean (278ms)  : 273, 283

    section Bailout
    This PR (7854) - mean (287ms)  : 280, 293
    master - mean (278ms)  : 274, 282

    section CallTarget+Inlining+NGEN
    This PR (7854) - mean (965ms)  : 906, 1025
    master - mean (913ms)  : 856, 971

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7854) - mean (289ms)  : 277, 301
    master - mean (272ms)  : 265, 278

    section Bailout
    This PR (7854) - mean (290ms)  : crit, 273, 307
    master - mean (271ms)  : 267, 274

    section CallTarget+Inlining+NGEN
    This PR (7854) - mean (976ms)  : crit, 914, 1038
    master - mean (888ms)  : 844, 931

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7854) - mean (290ms)  : 276, 304
    master - mean (270ms)  : 264, 276

    section Bailout
    This PR (7854) - mean (286ms)  : crit, 274, 298
    master - mean (270ms)  : 266, 274

    section CallTarget+Inlining+NGEN
    This PR (7854) - mean (902ms)  : crit, 859, 945
    master - mean (830ms)  : 812, 849

Loading

@datadog-datadog-prod-us1

This comment has been minimized.

@pr-commenter
Copy link

pr-commenter bot commented Nov 24, 2025

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #7854 compared to master:

  • 8 benchmarks are faster, with geometric mean 1.382
  • 3 benchmarks are slower, with geometric mean 1.436
  • 16 benchmarks have fewer allocations
  • 5 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 ✔️ More allocations ⚠️

More allocations ⚠️ in #7854

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472 6.01 KB 6.09 KB 79 B 1.31%
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑netcoreapp3.1 5.71 KB 5.76 KB 47 B 0.82%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 9.99μs 54.5ns 332ns 0 0 0 5.5 KB
master StartStopWithChild netcoreapp3.1 13.6μs 70.4ns 330ns 0 0 0 5.71 KB
master StartStopWithChild net472 21.8μs 120ns 741ns 0.978 0.435 0.109 6.01 KB
#7854 StartStopWithChild net6.0 11.1μs 53.9ns 216ns 0 0 0 5.52 KB
#7854 StartStopWithChild netcoreapp3.1 14.7μs 68.5ns 274ns 0 0 0 5.76 KB
#7854 StartStopWithChild net472 21.5μs 101ns 378ns 1.04 0.345 0.115 6.09 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 939μs 45.8ns 177ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.02ms 623ns 2.41μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.22ms 61.8ns 231ns 0 0 0 3.31 KB
#7854 WriteAndFlushEnrichedTraces net6.0 927μs 69.1ns 249ns 0 0 0 2.71 KB
#7854 WriteAndFlushEnrichedTraces netcoreapp3.1 1.02ms 124ns 446ns 0 0 0 2.7 KB
#7854 WriteAndFlushEnrichedTraces net472 1.22ms 587ns 2.12μs 0 0 0 3.31 KB
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 1.09μs 1.29ns 5.01ns 0 0 0 1.22 KB
master AllCycleSimpleBody netcoreapp3.1 1.39μs 7.67ns 46.6ns 0 0 0 1.2 KB
master AllCycleSimpleBody net472 1.03μs 0.897ns 3.47ns 0.194 0 0 1.23 KB
master AllCycleMoreComplexBody net6.0 7.28μs 33.8ns 131ns 0 0 0 4.72 KB
master AllCycleMoreComplexBody netcoreapp3.1 8.98μs 32ns 124ns 0 0 0 4.62 KB
master AllCycleMoreComplexBody net472 7.7μs 4.79ns 18.6ns 0.729 0 0 4.74 KB
master ObjectExtractorSimpleBody net6.0 331ns 1.68ns 7.52ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 401ns 2.2ns 12.2ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 298ns 0.167ns 0.648ns 0.0436 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.4μs 30.1ns 141ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.86μs 29.1ns 113ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.67μs 5.3ns 19.8ns 0.602 0 0 3.8 KB
#7854 AllCycleSimpleBody net6.0 1.05μs 6.27ns 62.7ns 0 0 0 1.22 KB
#7854 AllCycleSimpleBody netcoreapp3.1 1.43μs 7.01ns 29.7ns 0 0 0 1.2 KB
#7854 AllCycleSimpleBody net472 1.04μs 0.391ns 1.46ns 0.192 0 0 1.23 KB
#7854 AllCycleMoreComplexBody net6.0 7.03μs 36ns 180ns 0 0 0 4.72 KB
#7854 AllCycleMoreComplexBody netcoreapp3.1 9.22μs 43.9ns 175ns 0 0 0 4.62 KB
#7854 AllCycleMoreComplexBody net472 7.69μs 2.82ns 10.6ns 0.734 0 0 4.74 KB
#7854 ObjectExtractorSimpleBody net6.0 318ns 0.313ns 1.21ns 0 0 0 280 B
#7854 ObjectExtractorSimpleBody netcoreapp3.1 415ns 2.06ns 8.5ns 0 0 0 272 B
#7854 ObjectExtractorSimpleBody net472 294ns 0.0374ns 0.14ns 0.0445 0 0 281 B
#7854 ObjectExtractorMoreComplexBody net6.0 6.26μs 28.8ns 115ns 0 0 0 3.78 KB
#7854 ObjectExtractorMoreComplexBody netcoreapp3.1 7.77μs 38.4ns 172ns 0 0 0 3.69 KB
#7854 ObjectExtractorMoreComplexBody net472 6.69μs 2.05ns 7.93ns 0.602 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 76.6μs 213ns 796ns 0 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 96.3μs 207ns 774ns 0 0 0 32.4 KB
master EncodeArgs net472 112μs 7.66ns 26.5ns 5.03 0 0 32.51 KB
master EncodeLegacyArgs net6.0 145μs 25.7ns 99.6ns 0 0 0 2.15 KB
master EncodeLegacyArgs netcoreapp3.1 197μs 83.5ns 289ns 0 0 0 2.14 KB
master EncodeLegacyArgs net472 264μs 96ns 372ns 0 0 0 2.16 KB
#7854 EncodeArgs net6.0 77.3μs 62.2ns 224ns 0 0 0 32.4 KB
#7854 EncodeArgs netcoreapp3.1 97.6μs 87.2ns 326ns 0 0 0 32.4 KB
#7854 EncodeArgs net472 109μs 18.5ns 69.1ns 4.9 0 0 32.51 KB
#7854 EncodeLegacyArgs net6.0 144μs 314ns 1.22μs 0 0 0 2.15 KB
#7854 EncodeLegacyArgs netcoreapp3.1 197μs 228ns 882ns 0 0 0 2.14 KB
#7854 EncodeLegacyArgs net472 264μs 70.2ns 272ns 0 0 0 2.16 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Slower ⚠️ Fewer allocations 🎉

Slower ⚠️ in #7854

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑netcoreapp3.1 2.150 340,000.00 731,127.23

Faster 🎉 in #7854

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑net472 1.199 370,650.00 309,194.05
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑net6.0 1.173 456,200.00 388,807.52 several?
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑netcoreapp3.1 1.171 490,600.00 418,844.79 bimodal
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑net472 1.167 503,150.00 431,148.71

Fewer allocations 🎉 in #7854

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑netcoreapp3.1 4.58 KB 4.48 KB -104 B -2.27%
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑netcoreapp3.1 2.32 KB 2.22 KB -104 B -4.48%
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑net6.0 5.48 KB 4.55 KB -927 B -16.92%
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑net6.0 3.5 KB 2.24 KB -1.26 KB -36.02%
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑net472 8.19 KB 4.66 KB -3.53 KB -43.10%
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑net472 8.19 KB 2.29 KB -5.91 KB -72.11%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 457μs 3.08μs 30.6μs 0 0 0 5.48 KB
master RunWafRealisticBenchmark netcoreapp3.1 496μs 4.32μs 42.1μs 0 0 0 4.58 KB
master RunWafRealisticBenchmark net472 503μs 607ns 2.27μs 0 0 0 8.19 KB
master RunWafRealisticBenchmarkWithAttack net6.0 311μs 778ns 2.81μs 0 0 0 3.5 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 352μs 3.19μs 31μs 0 0 0 2.32 KB
master RunWafRealisticBenchmarkWithAttack net472 371μs 373ns 1.29μs 0 0 0 8.19 KB
#7854 RunWafRealisticBenchmark net6.0 389μs 83.3ns 312ns 0 0 0 4.55 KB
#7854 RunWafRealisticBenchmark netcoreapp3.1 417μs 925ns 3.58μs 0 0 0 4.48 KB
#7854 RunWafRealisticBenchmark net472 431μs 58.6ns 227ns 0 0 0 4.66 KB
#7854 RunWafRealisticBenchmarkWithAttack net6.0 283μs 43.6ns 163ns 0 0 0 2.24 KB
#7854 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 723μs 5.13μs 50.8μs 0 0 0 2.22 KB
#7854 RunWafRealisticBenchmarkWithAttack net472 309μs 25.8ns 100ns 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.4μs 113ns 422ns 0 0 0 14.52 KB
master SendRequest netcoreapp3.1 71.1μs 70.2ns 253ns 0 0 0 17.42 KB
master SendRequest net472 0.00553ns 0.00212ns 0.00822ns 0 0 0 0 b
#7854 SendRequest net6.0 61.2μs 280ns 1.05μs 0 0 0 14.52 KB
#7854 SendRequest netcoreapp3.1 71.7μs 137ns 494ns 0 0 0 17.42 KB
#7854 SendRequest net472 0.0054ns 0.00196ns 0.0076ns 0 0 0 0 b
Benchmarks.Trace.CharSliceBenchmark - Faster 🎉 Fewer allocations 🎉

Faster 🎉 in #7854

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑netcoreapp3.1 2.361 2,000,000.00 847,035.00
Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice‑netcoreapp3.1 1.807 3,966,450.00 2,195,292.97
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑netcoreapp3.1 1.415 2,817,700.00 1,990,708.75
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 1.149 1,009,100.00 878,328.96

Fewer allocations 🎉 in #7854

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice‑net472 647.17 KB 641.95 KB -5.21 KB -0.81%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑netcoreapp3.1 104 B 17 B -87 B -83.65%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 304 B 4 B -300 B -98.68%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑netcoreapp3.1 104 B 1 B -103 B -99.04%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net472 8.19 KB 73 B -8.12 KB -99.11%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net472 8.19 KB 47 B -8.15 KB -99.43%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net6.0 976 B 4 B -972 B -99.59%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master OriginalCharSlice net6.0 1.89ms 907ns 3.51μs 0 0 0 640.3 KB
master OriginalCharSlice netcoreapp3.1 3.97ms 1.68μs 6.27μs 0 0 0 640.1 KB
master OriginalCharSlice net472 2.64ms 648ns 2.42μs 0 0 0 647.17 KB
master OptimizedCharSlice net6.0 1.4ms 554ns 2.07μs 0 0 0 976 B
master OptimizedCharSlice netcoreapp3.1 2.82ms 905ns 3.39μs 0 0 0 104 B
master OptimizedCharSlice net472 1.99ms 996ns 3.59μs 0 0 0 8.19 KB
master OptimizedCharSliceWithPool net6.0 1.01ms 347ns 1.3μs 0 0 0 304 B
master OptimizedCharSliceWithPool netcoreapp3.1 2ms 2.03μs 7.88μs 0 0 0 104 B
master OptimizedCharSliceWithPool net472 1.15ms 639ns 2.39μs 0 0 0 8.19 KB
#7854 OriginalCharSlice net6.0 1.9ms 5.32μs 20.6μs 0 0 0 640.01 KB
#7854 OriginalCharSlice netcoreapp3.1 2.2ms 9.41μs 35.2μs 0 0 0 640 KB
#7854 OriginalCharSlice net472 2.63ms 803ns 3μs 100 0 0 641.95 KB
#7854 OptimizedCharSlice net6.0 1.5ms 193ns 748ns 0 0 0 4 B
#7854 OptimizedCharSlice netcoreapp3.1 1.99ms 1.04μs 4.02μs 0 0 0 1 B
#7854 OptimizedCharSlice net472 1.95ms 218ns 843ns 0 0 0 73 B
#7854 OptimizedCharSliceWithPool net6.0 878μs 38.1ns 142ns 0 0 0 4 B
#7854 OptimizedCharSliceWithPool netcoreapp3.1 847μs 124ns 480ns 0 0 0 17 B
#7854 OptimizedCharSliceWithPool net472 1.15ms 167ns 625ns 0 0 0 47 B
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Slower ⚠️ Fewer allocations 🎉

Slower ⚠️ in #7854

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 1.191 830,691.25 989,293.53
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 1.156 625,569.95 723,420.66

Fewer allocations 🎉 in #7854

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 56.18 KB 55.89 KB -293 B -0.52%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 685μs 1.86μs 7.21μs 0 0 0 41.71 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 627μs 903ns 3.5μs 0 0 0 41.98 KB
master WriteAndFlushEnrichedTraces net472 832μs 1.3μs 4.88μs 8.33 0 0 56.18 KB
#7854 WriteAndFlushEnrichedTraces net6.0 707μs 3.57μs 16.7μs 0 0 0 41.78 KB
#7854 WriteAndFlushEnrichedTraces netcoreapp3.1 708μs 4.04μs 29.7μs 0 0 0 42.1 KB
#7854 WriteAndFlushEnrichedTraces net472 988μs 2.82μs 10.6μs 4.46 0 0 55.89 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.93μs 9.98ns 47.9ns 0 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 2.47μs 11.2ns 40.5ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.71μs 1.89ns 7.31ns 0.15 0 0 987 B
#7854 ExecuteNonQuery net6.0 1.9μs 7.95ns 30.8ns 0 0 0 1.02 KB
#7854 ExecuteNonQuery netcoreapp3.1 2.51μs 10.4ns 39ns 0 0 0 1.02 KB
#7854 ExecuteNonQuery net472 2.84μs 3.26ns 12.6ns 0.155 0.0141 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.76μs 8.03ns 30ns 0 0 0 1.03 KB
master CallElasticsearch netcoreapp3.1 2.23μs 11.7ns 56.2ns 0 0 0 1.03 KB
master CallElasticsearch net472 3.57μs 3.38ns 13.1ns 0.16 0 0 1.04 KB
master CallElasticsearchAsync net6.0 1.79μs 8.33ns 32.3ns 0 0 0 1.01 KB
master CallElasticsearchAsync netcoreapp3.1 2.44μs 8.58ns 33.2ns 0 0 0 1.08 KB
master CallElasticsearchAsync net472 3.71μs 1.19ns 4.6ns 0.165 0 0 1.1 KB
#7854 CallElasticsearch net6.0 1.72μs 8.59ns 40.3ns 0 0 0 1.03 KB
#7854 CallElasticsearch netcoreapp3.1 2.22μs 10.5ns 42ns 0 0 0 1.03 KB
#7854 CallElasticsearch net472 3.64μs 3.97ns 15.4ns 0.164 0 0 1.04 KB
#7854 CallElasticsearchAsync net6.0 1.85μs 9.74ns 47.7ns 0 0 0 1.01 KB
#7854 CallElasticsearchAsync netcoreapp3.1 2.38μs 7.35ns 26.5ns 0 0 0 1.08 KB
#7854 CallElasticsearchAsync net472 3.79μs 2.92ns 11.3ns 0.172 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.82μs 5.61ns 21.7ns 0 0 0 952 B
master ExecuteAsync netcoreapp3.1 2.35μs 10.9ns 43.4ns 0 0 0 952 B
master ExecuteAsync net472 2.67μs 3.16ns 12.2ns 0.133 0 0 915 B
#7854 ExecuteAsync net6.0 1.86μs 0.905ns 3.51ns 0 0 0 952 B
#7854 ExecuteAsync netcoreapp3.1 2.42μs 9.68ns 37.5ns 0 0 0 952 B
#7854 ExecuteAsync net472 2.6μs 1.66ns 5.98ns 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 6.79μs 10ns 38.9ns 0 0 0 2.36 KB
master SendAsync netcoreapp3.1 8.96μs 35ns 135ns 0 0 0 2.9 KB
master SendAsync net472 12.2μs 10.5ns 40.6ns 0.488 0 0 3.18 KB
#7854 SendAsync net6.0 7.33μs 20.3ns 73.2ns 0 0 0 2.36 KB
#7854 SendAsync netcoreapp3.1 8.75μs 6.05ns 23.4ns 0 0 0 2.9 KB
#7854 SendAsync net472 12.3μs 9.21ns 35.7ns 0.492 0 0 3.18 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7854

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 250.62 KB 258.94 KB 8.32 KB 3.32%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472 278.53 KB 286.72 KB 8.19 KB 2.94%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 43.36 KB 43.73 KB 368 B 0.85%

Fewer allocations 🎉 in #7854

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1 44.04 KB 42.64 KB -1.4 KB -3.18%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 272.86 KB 257.05 KB -15.81 KB -5.79%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 45μs 249ns 1.41μs 0 0 0 43.36 KB
master StringConcatBenchmark netcoreapp3.1 48.4μs 200ns 720ns 0 0 0 44.04 KB
master StringConcatBenchmark net472 57.5μs 127ns 459ns 0 0 0 57.34 KB
master StringConcatAspectBenchmark net6.0 445μs 2.37μs 12.1μs 0 0 0 250.62 KB
master StringConcatAspectBenchmark netcoreapp3.1 528μs 2.53μs 10.1μs 0 0 0 272.86 KB
master StringConcatAspectBenchmark net472 411μs 2.21μs 12.5μs 0 0 0 278.53 KB
#7854 StringConcatBenchmark net6.0 45.1μs 260ns 1.88μs 0 0 0 43.73 KB
#7854 StringConcatBenchmark netcoreapp3.1 47.5μs 258ns 1.46μs 0 0 0 42.64 KB
#7854 StringConcatBenchmark net472 55.6μs 212ns 793ns 0 0 0 57.34 KB
#7854 StringConcatAspectBenchmark net6.0 487μs 1.11μs 3.83μs 0 0 0 258.94 KB
#7854 StringConcatAspectBenchmark netcoreapp3.1 496μs 1.21μs 4.36μs 0 0 0 257.05 KB
#7854 StringConcatAspectBenchmark net472 414μs 2.2μs 11.7μs 0 0 0 286.72 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.64μs 13.6ns 67.9ns 0 0 0 1.7 KB
master EnrichedLog netcoreapp3.1 3.56μs 15.7ns 60.6ns 0 0 0 1.7 KB
master EnrichedLog net472 3.82μs 2.9ns 11.2ns 0.245 0 0 1.64 KB
#7854 EnrichedLog net6.0 2.63μs 13.3ns 61.1ns 0 0 0 1.7 KB
#7854 EnrichedLog netcoreapp3.1 3.67μs 17.3ns 75.4ns 0 0 0 1.7 KB
#7854 EnrichedLog net472 3.86μs 6.56ns 25.4ns 0.249 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 124μs 129ns 483ns 0 0 0 4.31 KB
master EnrichedLog netcoreapp3.1 127μs 70.9ns 256ns 0 0 0 4.31 KB
master EnrichedLog net472 168μs 128ns 495ns 0 0 0 4.52 KB
#7854 EnrichedLog net6.0 122μs 70.3ns 244ns 0 0 0 4.31 KB
#7854 EnrichedLog netcoreapp3.1 128μs 220ns 852ns 0 0 0 4.31 KB
#7854 EnrichedLog net472 167μs 69.4ns 269ns 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 4.91μs 23.1ns 92.4ns 0 0 0 2.26 KB
master EnrichedLog netcoreapp3.1 6.93μs 26.5ns 103ns 0 0 0 2.26 KB
master EnrichedLog net472 7.38μs 5.92ns 22.9ns 0.297 0 0 2.08 KB
#7854 EnrichedLog net6.0 4.94μs 5.54ns 21.5ns 0 0 0 2.26 KB
#7854 EnrichedLog netcoreapp3.1 6.79μs 6.44ns 24.9ns 0 0 0 2.26 KB
#7854 EnrichedLog net472 7.63μs 9.1ns 35.2ns 0.307 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 1.94μs 8.91ns 34.5ns 0 0 0 1.2 KB
master SendReceive netcoreapp3.1 2.54μs 10.8ns 41.9ns 0 0 0 1.2 KB
master SendReceive net472 2.96μs 2.36ns 8.82ns 0.191 0 0 1.2 KB
#7854 SendReceive net6.0 2.05μs 6.31ns 24.4ns 0 0 0 1.2 KB
#7854 SendReceive netcoreapp3.1 2.58μs 10.6ns 40.9ns 0 0 0 1.2 KB
#7854 SendReceive net472 3.07μs 7.82ns 30.3ns 0.182 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.29μs 1.1ns 4.11ns 0 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 5.94μs 15.6ns 60.6ns 0 0 0 1.63 KB
master EnrichedLog net472 6.55μs 5.18ns 20.1ns 0.293 0 0 2.03 KB
#7854 EnrichedLog net6.0 4.29μs 3.88ns 14ns 0 0 0 1.58 KB
#7854 EnrichedLog netcoreapp3.1 5.73μs 20.5ns 79.3ns 0 0 0 1.63 KB
#7854 EnrichedLog net472 6.38μs 7.25ns 28.1ns 0.32 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 790ns 3.61ns 14.4ns 0 0 0 576 B
master StartFinishSpan netcoreapp3.1 960ns 0.356ns 1.38ns 0 0 0 576 B
master StartFinishSpan net472 917ns 0.121ns 0.471ns 0.0916 0 0 578 B
master StartFinishScope net6.0 937ns 0.434ns 1.68ns 0 0 0 696 B
master StartFinishScope netcoreapp3.1 1.13μs 5.83ns 26.7ns 0 0 0 696 B
master StartFinishScope net472 1.1μs 0.186ns 0.721ns 0.0993 0 0 658 B
#7854 StartFinishSpan net6.0 780ns 3.33ns 19.4ns 0 0 0 576 B
#7854 StartFinishSpan netcoreapp3.1 972ns 4.85ns 21.1ns 0 0 0 576 B
#7854 StartFinishSpan net472 947ns 0.185ns 0.718ns 0.09 0 0 578 B
#7854 StartFinishScope net6.0 920ns 5.05ns 30.3ns 0 0 0 696 B
#7854 StartFinishScope netcoreapp3.1 1.21μs 0.68ns 2.63ns 0 0 0 696 B
#7854 StartFinishScope net472 1.15μs 1.32ns 4.94ns 0.103 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 1.43ns 5.15ns 0 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 1.38μs 6.5ns 25.2ns 0 0 0 696 B
master RunOnMethodBegin net472 1.44μs 1.51ns 5.85ns 0.101 0 0 658 B
#7854 RunOnMethodBegin net6.0 1.04μs 5.53ns 29.2ns 0 0 0 696 B
#7854 RunOnMethodBegin netcoreapp3.1 1.46μs 4.04ns 15.6ns 0 0 0 696 B
#7854 RunOnMethodBegin net472 1.49μs 0.919ns 3.56ns 0.104 0 0 658 B

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

Thaks!

connection.Open();
return connection;
}
catch (SqlException ex)
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we need to be more specific about the exact type of SqlException we catch here, e.g. the error code? 🤔 My concern is that we break something (e.g. using DBM) and we end up just skipping and not realising? WDYT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I was thinking about it. There are actually some codes we could get but, for simplicity, since we are only covering the connection method, I decided to leave it like this. Otherwise, we should capture these possible codes:

static bool IsRetryableConnectionError(SqlException ex)
{
return ex.Number == -1 || // Generic network error
ex.Number == -2 || // Connection timeout
ex.Number == 0 || // Provider-specific (platform dependent)
ex.Number == 2 || // Network path not found
ex.Number == 53 || // SQL Server not found
ex.Number == 64 || // Connection broken
ex.Number == 233 || // Shared memory failed
ex.Number == 258 || // Wait timeout
ex.Number == 10053 || // Connection aborted
ex.Number == 10054 || // Connection reset
ex.Number == 10060 || // Connection timeout
ex.Number == 10061 || // Connection refused
ex.Number == 11001 || // DNS failure
ex.Class == 20; // Fatal connection errors
}

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I'm torn tbh... for example, some of those I probably wouldn't want to ignore, as they could indicate some other issue (e.g. in our connection instrumentation)... e.g. 0 || // Provider-specific (platform dependent), ex.Number == 233 || // Shared memory failed, and ex.Class == 20; // Fatal connection errors would all worry me a bit 😅

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have added this check:
static bool IsRetryableConnectionError(SqlException ex)
{
// Known reliable error codes
if (ex.Number == -1 || // Generic network error
ex.Number == -2 || // Connection timeout
ex.Number == 53 || // SQL Server not found
ex.Number == 10053 || // Connection aborted
ex.Number == 10054 || // Connection reset
ex.Number == 10060 || // Connection timeout
ex.Number == 11001) // DNS failure
{
return true;
}

        // Number=0 with SocketException indicates network issue
        if (ex.Number == 0 && ex.InnerException is SocketException)
        {
            return true;
        }

        return false;
    }

@NachoEchevarria NachoEchevarria merged commit 2d191f0 into master Nov 28, 2025
153 checks passed
@NachoEchevarria NachoEchevarria deleted the nacho/AvoidSqlConnectionFlakiness branch November 28, 2025 10:42
@github-actions github-actions bot added this to the vNext-v3 milestone Nov 28, 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