From 617de87b199b37121f5a02cea2bce9b1a437400b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= <pkiekowicz@splunk.com>
Date: Mon, 29 Jan 2024 07:06:15 +0100
Subject: [PATCH 1/3] [Instrumentation.SqlClient] Support only stable HTTP
 semantic convention

---
 .../CHANGELOG.md                              |   7 ++
 ...Telemetry.Instrumentation.SqlClient.csproj |   4 -
 .../SqlClientInstrumentationOptions.cs        |  61 ++--------
 .../TracerProviderBuilderExtensions.cs        |  11 +-
 .../SqlClientInstrumentationOptionsTests.cs   | 109 +-----------------
 .../SqlEventSourceTests.netfx.cs              |   2 +-
 6 files changed, 21 insertions(+), 173 deletions(-)

diff --git a/src/OpenTelemetry.Instrumentation.SqlClient/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.SqlClient/CHANGELOG.md
index 75ca992ec03..31d8b70e2c1 100644
--- a/src/OpenTelemetry.Instrumentation.SqlClient/CHANGELOG.md
+++ b/src/OpenTelemetry.Instrumentation.SqlClient/CHANGELOG.md
@@ -2,6 +2,13 @@
 
 ## Unreleased
 
+* Removed support for the `OTEL_SEMCONV_STABILITY_OPT_IN` environment variable
+  which toggled the use of the new conventions for the
+  [server, client, and shared network attributes](https://github.com/open-telemetry/semantic-conventions/blob/v1.23.0/docs/general/attributes.md#server-client-and-shared-network-attributes).
+  Now that this suite of attributes are stable, this instrumentation will only
+  emit the new attributes.
+  ([#5270](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5270))
+
 ## 1.6.0-beta.3
 
 Released 2023-Nov-17
diff --git a/src/OpenTelemetry.Instrumentation.SqlClient/OpenTelemetry.Instrumentation.SqlClient.csproj b/src/OpenTelemetry.Instrumentation.SqlClient/OpenTelemetry.Instrumentation.SqlClient.csproj
index 5d106120453..113c5ec5d9f 100644
--- a/src/OpenTelemetry.Instrumentation.SqlClient/OpenTelemetry.Instrumentation.SqlClient.csproj
+++ b/src/OpenTelemetry.Instrumentation.SqlClient/OpenTelemetry.Instrumentation.SqlClient.csproj
@@ -12,9 +12,6 @@
 
   <ItemGroup>
     <Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
-    <Compile Include="$(RepoRoot)\src\Shared\EnvironmentVariables\*.cs" Link="Includes\EnvironmentVariables\%(Filename).cs" />
-    <Compile Include="$(RepoRoot)\src\Shared\HttpSemanticConventionHelper.cs" Link="Includes\HttpSemanticConventionHelper.cs" />
-    <Compile Include="$(RepoRoot)\src\Shared\Options\*.cs" Link="Includes\Options\%(Filename).cs" />
     <Compile Include="$(RepoRoot)\src\Shared\Shims\NullableAttributes.cs" Link="Includes\Shims\NullableAttributes.cs" />
   </ItemGroup>
 
@@ -29,7 +26,6 @@
 
   <ItemGroup>
     <PackageReference Include="Microsoft.Extensions.Options" />
-    <PackageReference Include="Microsoft.Extensions.Configuration" />
   </ItemGroup>
 
 </Project>
diff --git a/src/OpenTelemetry.Instrumentation.SqlClient/SqlClientInstrumentationOptions.cs b/src/OpenTelemetry.Instrumentation.SqlClient/SqlClientInstrumentationOptions.cs
index f9b808b264b..27248b90dbd 100644
--- a/src/OpenTelemetry.Instrumentation.SqlClient/SqlClientInstrumentationOptions.cs
+++ b/src/OpenTelemetry.Instrumentation.SqlClient/SqlClientInstrumentationOptions.cs
@@ -5,9 +5,7 @@
 using System.Data;
 using System.Diagnostics;
 using System.Text.RegularExpressions;
-using Microsoft.Extensions.Configuration;
 using OpenTelemetry.Trace;
-using static OpenTelemetry.Internal.HttpSemanticConventionHelper;
 
 namespace OpenTelemetry.Instrumentation.SqlClient;
 
@@ -52,26 +50,6 @@ public class SqlClientInstrumentationOptions
 
     private static readonly ConcurrentDictionary<string, SqlConnectionDetails> ConnectionDetailCache = new(StringComparer.OrdinalIgnoreCase);
 
-    private readonly bool emitOldAttributes;
-    private readonly bool emitNewAttributes;
-
-    /// <summary>
-    /// Initializes a new instance of the <see cref="SqlClientInstrumentationOptions"/> class.
-    /// </summary>
-    public SqlClientInstrumentationOptions()
-        : this(new ConfigurationBuilder().AddEnvironmentVariables().Build())
-    {
-    }
-
-    internal SqlClientInstrumentationOptions(IConfiguration configuration)
-    {
-        Debug.Assert(configuration != null, "configuration was null");
-
-        var httpSemanticConvention = GetSemanticConventionOptIn(configuration);
-        this.emitOldAttributes = httpSemanticConvention.HasFlag(HttpSemanticConvention.Old);
-        this.emitNewAttributes = httpSemanticConvention.HasFlag(HttpSemanticConvention.New);
-    }
-
     /// <summary>
     /// Gets or sets a value indicating whether or not the <see
     /// cref="SqlClientInstrumentation"/> should add the names of <see
@@ -301,40 +279,19 @@ internal void AddConnectionLevelDetailsToActivity(string dataSource, Activity sq
                 sqlActivity.SetTag(SemanticConventions.AttributeDbMsSqlInstanceName, connectionDetails.InstanceName);
             }
 
-            if (this.emitOldAttributes)
+            if (!string.IsNullOrEmpty(connectionDetails.ServerHostName))
             {
-                if (!string.IsNullOrEmpty(connectionDetails.ServerHostName))
-                {
-                    sqlActivity.SetTag(SemanticConventions.AttributeNetPeerName, connectionDetails.ServerHostName);
-                }
-                else
-                {
-                    sqlActivity.SetTag(SemanticConventions.AttributeNetPeerIp, connectionDetails.ServerIpAddress);
-                }
-
-                if (!string.IsNullOrEmpty(connectionDetails.Port))
-                {
-                    sqlActivity.SetTag(SemanticConventions.AttributeNetPeerPort, connectionDetails.Port);
-                }
+                sqlActivity.SetTag(SemanticConventions.AttributeServerAddress, connectionDetails.ServerHostName);
             }
-
-            // see the spec https://github.com/open-telemetry/semantic-conventions/blob/v1.21.0/docs/database/database-spans.md
-            if (this.emitNewAttributes)
+            else
             {
-                if (!string.IsNullOrEmpty(connectionDetails.ServerHostName))
-                {
-                    sqlActivity.SetTag(SemanticConventions.AttributeServerAddress, connectionDetails.ServerHostName);
-                }
-                else
-                {
-                    sqlActivity.SetTag(SemanticConventions.AttributeServerSocketAddress, connectionDetails.ServerIpAddress);
-                }
+                sqlActivity.SetTag(SemanticConventions.AttributeServerSocketAddress, connectionDetails.ServerIpAddress);
+            }
 
-                if (!string.IsNullOrEmpty(connectionDetails.Port))
-                {
-                    // TODO: Should we continue to emit this if the default port (1433) is being used?
-                    sqlActivity.SetTag(SemanticConventions.AttributeServerPort, connectionDetails.Port);
-                }
+            if (!string.IsNullOrEmpty(connectionDetails.Port))
+            {
+                // TODO: Should we continue to emit this if the default port (1433) is being used?
+                sqlActivity.SetTag(SemanticConventions.AttributeServerPort, connectionDetails.Port);
             }
         }
     }
diff --git a/src/OpenTelemetry.Instrumentation.SqlClient/TracerProviderBuilderExtensions.cs b/src/OpenTelemetry.Instrumentation.SqlClient/TracerProviderBuilderExtensions.cs
index 59ec17c67ee..774d64ed913 100644
--- a/src/OpenTelemetry.Instrumentation.SqlClient/TracerProviderBuilderExtensions.cs
+++ b/src/OpenTelemetry.Instrumentation.SqlClient/TracerProviderBuilderExtensions.cs
@@ -62,15 +62,10 @@ public static TracerProviderBuilder AddSqlClientInstrumentation(
 
         name ??= Options.DefaultName;
 
-        builder.ConfigureServices(services =>
+        if (configureSqlClientInstrumentationOptions != null)
         {
-            if (configureSqlClientInstrumentationOptions != null)
-            {
-                services.Configure(name, configureSqlClientInstrumentationOptions);
-            }
-
-            services.RegisterOptionsFactory(configuration => new SqlClientInstrumentationOptions(configuration));
-        });
+            builder.ConfigureServices(services => services.Configure(name, configureSqlClientInstrumentationOptions));
+        }
 
         builder.AddInstrumentation(sp =>
         {
diff --git a/test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlClientInstrumentationOptionsTests.cs b/test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlClientInstrumentationOptionsTests.cs
index 0e64fe4d130..7626706503c 100644
--- a/test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlClientInstrumentationOptionsTests.cs
+++ b/test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlClientInstrumentationOptionsTests.cs
@@ -2,10 +2,8 @@
 // SPDX-License-Identifier: Apache-2.0
 
 using System.Diagnostics;
-using Microsoft.Extensions.Configuration;
 using OpenTelemetry.Trace;
 using Xunit;
-using static OpenTelemetry.Internal.HttpSemanticConventionHelper;
 
 namespace OpenTelemetry.Instrumentation.SqlClient.Tests;
 
@@ -72,52 +70,7 @@ public void SqlClientInstrumentationOptions_EnableConnectionLevelAttributes(
     {
         var source = new ActivitySource("sql-client-instrumentation");
         var activity = source.StartActivity("Test Sql Activity");
-        var options = new SqlClientInstrumentationOptions
-        {
-            EnableConnectionLevelAttributes = enableConnectionLevelAttributes,
-        };
-        options.AddConnectionLevelDetailsToActivity(dataSource, activity);
-
-        if (!enableConnectionLevelAttributes)
-        {
-            Assert.Equal(expectedServerHostName, activity.GetTagValue(SemanticConventions.AttributePeerService));
-        }
-        else
-        {
-            Assert.Equal(expectedServerHostName, activity.GetTagValue(SemanticConventions.AttributeNetPeerName));
-        }
-
-        Assert.Equal(expectedServerIpAddress, activity.GetTagValue(SemanticConventions.AttributeNetPeerIp));
-        Assert.Equal(expectedInstanceName, activity.GetTagValue(SemanticConventions.AttributeDbMsSqlInstanceName));
-        Assert.Equal(expectedPort, activity.GetTagValue(SemanticConventions.AttributeNetPeerPort));
-    }
-
-    // Tests for v1.21.0 Semantic Conventions for database client calls.
-    // see the spec https://github.com/open-telemetry/semantic-conventions/blob/v1.21.0/docs/database/database-spans.md
-    // This test emits the new attributes.
-    // This test method can replace the other (old) test method when this library is GA.
-    [Theory]
-    [InlineData(true, "localhost", "localhost", null, null, null)]
-    [InlineData(true, "127.0.0.1,1433", null, "127.0.0.1", null, null)]
-    [InlineData(true, "127.0.0.1,1434", null, "127.0.0.1", null, "1434")]
-    [InlineData(true, "127.0.0.1\\instanceName, 1818", null, "127.0.0.1", "instanceName", "1818")]
-    [InlineData(false, "localhost", "localhost", null, null, null)]
-    public void SqlClientInstrumentationOptions_EnableConnectionLevelAttributes_New(
-        bool enableConnectionLevelAttributes,
-        string dataSource,
-        string expectedServerHostName,
-        string expectedServerIpAddress,
-        string expectedInstanceName,
-        string expectedPort)
-    {
-        var source = new ActivitySource("sql-client-instrumentation");
-        var activity = source.StartActivity("Test Sql Activity");
-
-        var configuration = new ConfigurationBuilder()
-            .AddInMemoryCollection(new Dictionary<string, string> { [SemanticConventionOptInKeyName] = "http" })
-            .Build();
-
-        var options = new SqlClientInstrumentationOptions(configuration)
+        var options = new SqlClientInstrumentationOptions()
         {
             EnableConnectionLevelAttributes = enableConnectionLevelAttributes,
         };
@@ -136,64 +89,4 @@ public void SqlClientInstrumentationOptions_EnableConnectionLevelAttributes_New(
         Assert.Equal(expectedInstanceName, activity.GetTagValue(SemanticConventions.AttributeDbMsSqlInstanceName));
         Assert.Equal(expectedPort, activity.GetTagValue(SemanticConventions.AttributeServerPort));
     }
-
-    // Tests for v1.21.0 Semantic Conventions for database client calls.
-    // see the spec https://github.com/open-telemetry/semantic-conventions/blob/v1.21.0/docs/database/database-spans.md
-    // This test emits both the new and older attributes.
-    // This test method can be deleted when this library is GA.
-    [Theory]
-    [InlineData(true, "localhost", "localhost", null, null, null)]
-    [InlineData(true, "127.0.0.1,1433", null, "127.0.0.1", null, null)]
-    [InlineData(true, "127.0.0.1,1434", null, "127.0.0.1", null, "1434")]
-    [InlineData(true, "127.0.0.1\\instanceName, 1818", null, "127.0.0.1", "instanceName", "1818")]
-    [InlineData(false, "localhost", "localhost", null, null, null)]
-    public void SqlClientInstrumentationOptions_EnableConnectionLevelAttributes_Dupe(
-        bool enableConnectionLevelAttributes,
-        string dataSource,
-        string expectedServerHostName,
-        string expectedServerIpAddress,
-        string expectedInstanceName,
-        string expectedPort)
-    {
-        var source = new ActivitySource("sql-client-instrumentation");
-        var activity = source.StartActivity("Test Sql Activity");
-
-        var configuration = new ConfigurationBuilder()
-            .AddInMemoryCollection(new Dictionary<string, string> { [SemanticConventionOptInKeyName] = "http/dup" })
-            .Build();
-
-        var options = new SqlClientInstrumentationOptions(configuration)
-        {
-            EnableConnectionLevelAttributes = enableConnectionLevelAttributes,
-        };
-        options.AddConnectionLevelDetailsToActivity(dataSource, activity);
-
-        // New
-        if (!enableConnectionLevelAttributes)
-        {
-            Assert.Equal(expectedServerHostName, activity.GetTagValue(SemanticConventions.AttributePeerService));
-        }
-        else
-        {
-            Assert.Equal(expectedServerHostName, activity.GetTagValue(SemanticConventions.AttributeServerAddress));
-        }
-
-        Assert.Equal(expectedServerIpAddress, activity.GetTagValue(SemanticConventions.AttributeServerSocketAddress));
-        Assert.Equal(expectedInstanceName, activity.GetTagValue(SemanticConventions.AttributeDbMsSqlInstanceName));
-        Assert.Equal(expectedPort, activity.GetTagValue(SemanticConventions.AttributeServerPort));
-
-        // Old
-        if (!enableConnectionLevelAttributes)
-        {
-            Assert.Equal(expectedServerHostName, activity.GetTagValue(SemanticConventions.AttributePeerService));
-        }
-        else
-        {
-            Assert.Equal(expectedServerHostName, activity.GetTagValue(SemanticConventions.AttributeNetPeerName));
-        }
-
-        Assert.Equal(expectedServerIpAddress, activity.GetTagValue(SemanticConventions.AttributeNetPeerIp));
-        Assert.Equal(expectedInstanceName, activity.GetTagValue(SemanticConventions.AttributeDbMsSqlInstanceName));
-        Assert.Equal(expectedPort, activity.GetTagValue(SemanticConventions.AttributeNetPeerPort));
-    }
 }
diff --git a/test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlEventSourceTests.netfx.cs b/test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlEventSourceTests.netfx.cs
index f931abb864c..2aede252238 100644
--- a/test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlEventSourceTests.netfx.cs
+++ b/test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlEventSourceTests.netfx.cs
@@ -230,7 +230,7 @@ private static void VerifyActivityData(
             }
             else
             {
-                Assert.Equal(connectionDetails.ServerIpAddress, activity.GetTagValue(SemanticConventions.AttributeNetPeerIp));
+                Assert.Equal(connectionDetails.ServerIpAddress, activity.GetTagValue(SemanticConventions.AttributeServerSocketAddress));
             }
 
             if (!string.IsNullOrEmpty(connectionDetails.InstanceName))

From d0c904dbe3ca1ea8cfc5c4f88a7610b616532717 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= <pkiekowicz@splunk.com>
Date: Mon, 29 Jan 2024 07:13:38 +0100
Subject: [PATCH 2/3] Drop HttpSemanticConventionHelper class.

It is no longer needed.
---
 OpenTelemetry.sln                             |  1 -
 src/Shared/HttpSemanticConventionHelper.cs    | 85 -------------------
 .../OpenTelemetry.Tests.csproj                |  1 -
 .../HttpSemanticConventionHelperTest.cs       | 79 -----------------
 4 files changed, 166 deletions(-)
 delete mode 100644 src/Shared/HttpSemanticConventionHelper.cs
 delete mode 100644 test/OpenTelemetry.Tests/Shared/HttpSemanticConventionHelperTest.cs

diff --git a/OpenTelemetry.sln b/OpenTelemetry.sln
index 7c8bb952f0e..28c8c85b510 100644
--- a/OpenTelemetry.sln
+++ b/OpenTelemetry.sln
@@ -265,7 +265,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{A49299
 		src\Shared\DiagnosticDefinitions.cs = src\Shared\DiagnosticDefinitions.cs
 		src\Shared\ExceptionExtensions.cs = src\Shared\ExceptionExtensions.cs
 		src\Shared\Guard.cs = src\Shared\Guard.cs
-		src\Shared\HttpSemanticConventionHelper.cs = src\Shared\HttpSemanticConventionHelper.cs
 		src\Shared\MathHelper.cs = src\Shared\MathHelper.cs
 		src\Shared\PeerServiceResolver.cs = src\Shared\PeerServiceResolver.cs
 		src\Shared\PeriodicExportingMetricReaderHelper.cs = src\Shared\PeriodicExportingMetricReaderHelper.cs
diff --git a/src/Shared/HttpSemanticConventionHelper.cs b/src/Shared/HttpSemanticConventionHelper.cs
deleted file mode 100644
index 220f9874acd..00000000000
--- a/src/Shared/HttpSemanticConventionHelper.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright The OpenTelemetry Authors
-// SPDX-License-Identifier: Apache-2.0
-
-#nullable enable
-
-using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
-using Microsoft.Extensions.Configuration;
-
-namespace OpenTelemetry.Internal;
-
-/// <summary>
-/// Helper class for Http Semantic Conventions.
-/// </summary>
-/// <remarks>
-/// Due to a breaking change in the semantic convention, affected instrumentation libraries
-/// must inspect an environment variable to determine which attributes to emit.
-/// This is expected to be removed when the instrumentation libraries reach Stable.
-/// <see href="https://github.com/open-telemetry/semantic-conventions/blob/v1.21.0/docs/http/http-spans.md"/>.
-/// </remarks>
-internal static class HttpSemanticConventionHelper
-{
-    public const string SemanticConventionOptInKeyName = "OTEL_SEMCONV_STABILITY_OPT_IN";
-
-    [Flags]
-    public enum HttpSemanticConvention
-    {
-        /// <summary>
-        /// Instructs an instrumentation library to emit the old experimental HTTP attributes.
-        /// </summary>
-        Old = 0x1,
-
-        /// <summary>
-        /// Instructs an instrumentation library to emit the new, v1.21.0 Http attributes.
-        /// </summary>
-        New = 0x2,
-
-        /// <summary>
-        /// Instructs an instrumentation library to emit both the old and new attributes.
-        /// </summary>
-        Dupe = Old | New,
-    }
-
-    public static HttpSemanticConvention GetSemanticConventionOptIn(IConfiguration configuration)
-    {
-        Debug.Assert(configuration != null, "configuration was null");
-
-        if (configuration != null && TryGetConfiguredValues(configuration, out var values))
-        {
-            if (values.Contains("http/dup"))
-            {
-                return HttpSemanticConvention.Dupe;
-            }
-            else if (values.Contains("http"))
-            {
-                return HttpSemanticConvention.New;
-            }
-        }
-
-        return HttpSemanticConvention.Old;
-    }
-
-    private static bool TryGetConfiguredValues(IConfiguration configuration, [NotNullWhen(true)] out HashSet<string>? values)
-    {
-        try
-        {
-            var stringValue = configuration[SemanticConventionOptInKeyName];
-
-            if (string.IsNullOrWhiteSpace(stringValue))
-            {
-                values = null;
-                return false;
-            }
-
-            var stringValues = stringValue!.Split(separator: new[] { ',', ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
-            values = new HashSet<string>(stringValues, StringComparer.OrdinalIgnoreCase);
-            return true;
-        }
-        catch
-        {
-            values = null;
-            return false;
-        }
-    }
-}
diff --git a/test/OpenTelemetry.Tests/OpenTelemetry.Tests.csproj b/test/OpenTelemetry.Tests/OpenTelemetry.Tests.csproj
index 0679b5d3653..86fe7e36844 100644
--- a/test/OpenTelemetry.Tests/OpenTelemetry.Tests.csproj
+++ b/test/OpenTelemetry.Tests/OpenTelemetry.Tests.csproj
@@ -20,7 +20,6 @@
 
   <ItemGroup>
     <Compile Include="$(RepoRoot)\src\Shared\ActivityInstrumentationHelper.cs" Link="Includes\ActivityInstrumentationHelper.cs" />
-    <Compile Include="$(RepoRoot)\src\Shared\HttpSemanticConventionHelper.cs" Link="Includes\HttpSemanticConventionHelper.cs" />
     <Compile Include="$(RepoRoot)\src\Shared\DiagnosticSourceInstrumentation\ListenerHandler.cs" Link="Includes\ListenerHandler.cs" />
     <Compile Include="$(RepoRoot)\src\Shared\DiagnosticSourceInstrumentation\PropertyFetcher.cs" Link="Includes\PropertyFetcher.cs" />
     <Compile Include="$(RepoRoot)\src\Shared\Metrics\Base2ExponentialBucketHistogramHelper.cs" Link="Includes\Metrics\Base2ExponentialBucketHistogramHelper.cs" />
diff --git a/test/OpenTelemetry.Tests/Shared/HttpSemanticConventionHelperTest.cs b/test/OpenTelemetry.Tests/Shared/HttpSemanticConventionHelperTest.cs
deleted file mode 100644
index a7fb0224bff..00000000000
--- a/test/OpenTelemetry.Tests/Shared/HttpSemanticConventionHelperTest.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright The OpenTelemetry Authors
-// SPDX-License-Identifier: Apache-2.0
-
-using Microsoft.Extensions.Configuration;
-using Xunit;
-using static OpenTelemetry.Internal.HttpSemanticConventionHelper;
-
-namespace OpenTelemetry.Tests.Shared;
-
-public class HttpSemanticConventionHelperTest
-{
-    public static IEnumerable<object[]> TestCases => new List<object[]>
-        {
-            new object[] { null,  HttpSemanticConvention.Old },
-            new object[] { string.Empty,  HttpSemanticConvention.Old },
-            new object[] { " ",  HttpSemanticConvention.Old },
-            new object[] { "junk",  HttpSemanticConvention.Old },
-            new object[] { "none",  HttpSemanticConvention.Old },
-            new object[] { "NONE",  HttpSemanticConvention.Old },
-            new object[] { "http",  HttpSemanticConvention.New },
-            new object[] { "HTTP",  HttpSemanticConvention.New },
-            new object[] { "http/dup",  HttpSemanticConvention.Dupe },
-            new object[] { "HTTP/DUP",  HttpSemanticConvention.Dupe },
-            new object[] { "junk,,junk",  HttpSemanticConvention.Old },
-            new object[] { "junk,JUNK",  HttpSemanticConvention.Old },
-            new object[] { "junk1,junk2",  HttpSemanticConvention.Old },
-            new object[] { "junk,http",  HttpSemanticConvention.New },
-            new object[] { "junk,http , http ,junk",  HttpSemanticConvention.New },
-            new object[] { "junk,http/dup",  HttpSemanticConvention.Dupe },
-            new object[] { "junk, http/dup ",  HttpSemanticConvention.Dupe },
-            new object[] { "http/dup,http",  HttpSemanticConvention.Dupe },
-            new object[] { "http,http/dup",  HttpSemanticConvention.Dupe },
-        };
-
-    [Fact]
-    public void VerifyFlags()
-    {
-        var testValue = HttpSemanticConvention.Dupe;
-        Assert.True(testValue.HasFlag(HttpSemanticConvention.Old));
-        Assert.True(testValue.HasFlag(HttpSemanticConvention.New));
-
-        testValue = HttpSemanticConvention.Old;
-        Assert.True(testValue.HasFlag(HttpSemanticConvention.Old));
-        Assert.False(testValue.HasFlag(HttpSemanticConvention.New));
-
-        testValue = HttpSemanticConvention.New;
-        Assert.False(testValue.HasFlag(HttpSemanticConvention.Old));
-        Assert.True(testValue.HasFlag(HttpSemanticConvention.New));
-    }
-
-    [Theory]
-    [MemberData(nameof(TestCases))]
-    public void VerifyGetSemanticConventionOptIn_UsingEnvironmentVariable(string input, string expectedValue)
-    {
-        try
-        {
-            Environment.SetEnvironmentVariable(SemanticConventionOptInKeyName, input);
-
-            var expected = Enum.Parse(typeof(HttpSemanticConvention), expectedValue);
-            Assert.Equal(expected, GetSemanticConventionOptIn(new ConfigurationBuilder().AddEnvironmentVariables().Build()));
-        }
-        finally
-        {
-            Environment.SetEnvironmentVariable(SemanticConventionOptInKeyName, null);
-        }
-    }
-
-    [Theory]
-    [MemberData(nameof(TestCases))]
-    public void VerifyGetSemanticConventionOptIn_UsingIConfiguration(string input, string expectedValue)
-    {
-        var configuration = new ConfigurationBuilder()
-            .AddInMemoryCollection(new Dictionary<string, string> { [SemanticConventionOptInKeyName] = input })
-            .Build();
-
-        var expected = Enum.Parse(typeof(HttpSemanticConvention), expectedValue);
-        Assert.Equal(expected, GetSemanticConventionOptIn(configuration));
-    }
-}

From 0675b34a52ac7d6618be6506773f36bf784ce32d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= <pkiekowicz@splunk.com>
Date: Mon, 29 Jan 2024 10:58:09 +0100
Subject: [PATCH 3/3] Fix code documentation

---
 .../SqlClientInstrumentationOptions.cs                     | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/src/OpenTelemetry.Instrumentation.SqlClient/SqlClientInstrumentationOptions.cs b/src/OpenTelemetry.Instrumentation.SqlClient/SqlClientInstrumentationOptions.cs
index 27248b90dbd..e2d54565ce6 100644
--- a/src/OpenTelemetry.Instrumentation.SqlClient/SqlClientInstrumentationOptions.cs
+++ b/src/OpenTelemetry.Instrumentation.SqlClient/SqlClientInstrumentationOptions.cs
@@ -108,13 +108,6 @@ public class SqlClientInstrumentationOptions
     /// <para>
     /// The default behavior is to set the SqlConnection DataSource as the <see cref="SemanticConventions.AttributePeerService"/> tag.
     /// If enabled, SqlConnection DataSource will be parsed and the server name will be sent as the
-    /// <see cref="SemanticConventions.AttributeNetPeerName"/> or <see cref="SemanticConventions.AttributeNetPeerIp"/> tag,
-    /// the instance name will be sent as the <see cref="SemanticConventions.AttributeDbMsSqlInstanceName"/> tag,
-    /// and the port will be sent as the <see cref="SemanticConventions.AttributeNetPeerPort"/> tag if it is not 1433 (the default port).
-    /// </para>
-    /// <para>
-    /// If the environment variable OTEL_SEMCONV_STABILITY_OPT_IN is set to "http", the newer Semantic Convention v1.21.0 Attributes will be emitted.
-    /// SqlConnection DataSource will be parsed and the server name will be sent as the
     /// <see cref="SemanticConventions.AttributeServerAddress"/> or <see cref="SemanticConventions.AttributeServerSocketAddress"/> tag,
     /// the instance name will be sent as the <see cref="SemanticConventions.AttributeDbMsSqlInstanceName"/> tag,
     /// and the port will be sent as the <see cref="SemanticConventions.AttributeServerPort"/> tag if it is not 1433 (the default port).