-
Notifications
You must be signed in to change notification settings - Fork 317
[6.1] Backport initial metrics enablement #3718
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
[6.1] Backport initial metrics enablement #3718
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/6.1 #3718 +/- ##
================================================
- Coverage 69.69% 59.32% -10.37%
================================================
Files 281 273 -8
Lines 62413 61434 -979
================================================
- Hits 43500 36448 -7052
- Misses 18913 24986 +6073
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Updated [Microsoft.Data.SqlClient](https://github.com/dotnet/sqlclient) from 6.1.2 to 6.1.3. <details> <summary>Release notes</summary> _Sourced from [Microsoft.Data.SqlClient's releases](https://github.com/dotnet/sqlclient/releases)._ ## 6.1.3 This update includes the following changes since the [6.1.2](https://github.com/dotnet/SqlClient/blob/main/release-notes/6.1/6.1.2.md) release: ### Added #### App Context Switch for Ignoring Server-Provided Failover Partner *What Changed:* - A new app context switch `Switch.Microsoft.Data.SqlClient.IgnoreServerProvidedFailoverPartner` was introduced to let the client ignore server-provided failover partner info in Basic Availability Groups (BAGs). When the switch is enabled, only the failover partner specified in the connection string is used; server-supplied partner values are skipped. This context switch was introduced in PR [#3702](dotnet/SqlClient#3702). *Who Benefits:* - Applications connecting to SQL Server BAGs using TCP and custom ports, especially where the server's provided partner name lacks the protocol, host, or port. This avoids connection failures when the server-provided partner is incompatible or incomplete. - Teams who manage availability groups and rely on client-side control of failover behavior in heterogeneous networking environments. *Impact:* - If your environment might be affected (i.e., you operate a BAG with custom ports, or have experienced failures after failover), you can enable the new switch in your application: ```c# AppContext.SetSwitch("Switch.Microsoft.Data.SqlClient.IgnoreServerProvidedFailoverPartner", true); ``` - Then, ensure your connection string includes your preferred failover partner (with correct `tcp:host,port`) so that the client uses that instead of the server's suggestion. - Without enabling this, by default, the client continues to prefer the server-provided partner, maintaining backwards compatibility. ### Fixed - Fixed an issue to ensure reliable metrics initialization during startup, preventing missed telemetry when EventSource is enabled early. ([#3718](dotnet/SqlClient#3718)) ## Target Platform Support - .NET Framework 4.6.2+ (Windows ARM64, Windows x86, Windows x64) - .NET 8.0+ (Windows x86, Windows x64, Windows ARM64, Windows ARM, Linux, macOS) ### Dependencies #### .NET Framework 4.6.2+ - Azure.Core 1.47.1 - Azure.Identity 1.14.2 - Microsoft.Bcl.Cryptography 8.0.0 - Microsoft.Data.SqlClient.SNI 6.0.2 - Microsoft.Extensions.Caching.Memory 8.0.1 - Microsoft.IdentityModel.JsonWebTokens 7.7.1 - Microsoft.IdentityModel.Protocols.OpenIdConnect 7.7.1 - System.Buffers 4.5.1 - System.Data.Common 4.3.0 - System.Security.Cryptography.Pkcs 8.0.1 - System.Text.Encodings.Web 8.0.0 ... (truncated) Commits viewable in [compare view](dotnet/SqlClient@v6.1.2...v6.1.3). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Description
This backports 66a67bc from #3575 to 6.1.
It's possible to start an application with the M.D.S EventSource already enabled, even before the static constructor for SqlClientEventSource has run. In this situation, the constructor for
Logwill runOnEventCommandwith an enablement command before it finishes executing. This enablement tries to callMetrics.EnableEventCounters, but this hasn't been initialized yet - it relies on theSqlClientEventSourceinstance.To break this cycle, we record the desired startup state of the metrics in this case, and pass it to the
SqlClientMetricsconstructor.Issues
Fixes #3711.
Testing
The timing makes this difficult to test. In the end, I built a test application locally, referenced 6.1.2 and ran
This allowed me to reproduce the problem: the counters appear in 6.0, don't appear in 6.1.2, appear again in 7.0-preview2 and now also appear in my local build.
Could someone run CI please? @empowerRob you should be able to verify with the nupkg build artifact.