Skip to content

Commit c3e2055

Browse files
committed
Remove AppContext switch
This isn't necessary. The existing OpenTelemetry ActivitySource uses the assembly name of SqlTelemetryHelper, but this type isn't in the SqlClient assembly. We can thus use an ActivitySource name of Microsoft.Data.SqlClient without generating any conflicts.
1 parent 8ea6742 commit c3e2055

2 files changed

Lines changed: 0 additions & 24 deletions

File tree

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalAppContextSwitches.cs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,6 @@ internal static class LocalAppContextSwitches
9494
private const string SuppressInsecureTlsWarningString =
9595
"Switch.Microsoft.Data.SqlClient.SuppressInsecureTLSWarning";
9696

97-
/// <summary>
98-
/// The name of the app context switch that controls whether to suppress
99-
/// the creation of <see cref="System.Diagnostics.Activity"/> instances.
100-
/// </summary>
101-
private const string SuppressNativeActivityTelemetryString =
102-
"Switch.Microsoft.Data.SqlClient.SuppressNativeActivityTelemetry";
103-
10497
/// <summary>
10598
/// The name of the app context switch that controls whether TdsParser
10699
/// truncates (rather than rounds) decimal and SqlDecimal values when
@@ -220,11 +213,6 @@ private enum SwitchValue : byte
220213
/// </summary>
221214
private static SwitchValue s_suppressInsecureTlsWarning = SwitchValue.None;
222215

223-
/// <summary>
224-
/// The cached value of the SuppressNativeActivityTelemetry switch.
225-
/// </summary>
226-
private static SwitchValue s_suppressNativeActivityTelemetry = SwitchValue.None;
227-
228216
/// <summary>
229217
/// The cached value of the TruncateScaledDecimal switch.
230218
/// </summary>
@@ -499,17 +487,6 @@ public static bool GlobalizationInvariantMode
499487
defaultValue: false,
500488
ref s_suppressInsecureTlsWarning);
501489

502-
/// <summary>
503-
/// Suppresses the creation of <see cref="System.Diagnostics.Activity"/> instances
504-
/// within SqlClient. This prevents duplicate activities from being recorded if an
505-
/// existing library already hooks other diagnostic pathways and creates them.
506-
/// </summary>
507-
public static bool SuppressNativeActivityTelemetry =>
508-
AcquireAndReturn(
509-
SuppressNativeActivityTelemetryString,
510-
defaultValue: false,
511-
ref s_suppressNativeActivityTelemetry);
512-
513490
/// <summary>
514491
/// When set to true, TdsParser will truncate (rather than round) decimal
515492
/// and SqlDecimal values when scaling them.

src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlClient/LocalAppContextSwitchesTest.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public void TestDefaultAppContextSwitchValues()
2020
{
2121
Assert.False(LocalAppContextSwitches.LegacyRowVersionNullBehavior);
2222
Assert.False(LocalAppContextSwitches.SuppressInsecureTlsWarning);
23-
Assert.False(LocalAppContextSwitches.SuppressNativeActivityTelemetry);
2423
Assert.False(LocalAppContextSwitches.MakeReadAsyncBlocking);
2524
Assert.True(LocalAppContextSwitches.UseMinimumLoginTimeout);
2625
Assert.True(LocalAppContextSwitches.LegacyVarTimeZeroScaleBehaviour);

0 commit comments

Comments
 (0)