diff --git a/build/Common.props b/build/Common.props index 8feec5f986e..8a0a062ca07 100644 --- a/build/Common.props +++ b/build/Common.props @@ -21,7 +21,7 @@ net8.0;net6.0;netstandard2.0;$(NetFrameworkMinimumSupportedVersion) net8.0;net6.0;netstandard2.1;netstandard2.0;$(NetFrameworkMinimumSupportedVersion) - net8.0;net7.0;net6.0;netstandard2.1;netstandard2.0 + net8.0;net7.0;net6.0;netstandard2.0 net8.0;net6.0;netstandard2.1;netstandard2.0 net8.0;net6.0 diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreInstrumentationOptions.cs b/src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreInstrumentationOptions.cs index b8fd7c5ba27..49a07167bab 100644 --- a/src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreInstrumentationOptions.cs +++ b/src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreInstrumentationOptions.cs @@ -77,7 +77,7 @@ public class AspNetCoreInstrumentationOptions /// public bool RecordException { get; set; } -#if NETSTANDARD2_1 || NET6_0_OR_GREATER +#if NET6_0_OR_GREATER /// /// Gets or sets a value indicating whether RPC attributes are added to an Activity when using Grpc.AspNetCore. Default is true. /// diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md index 67fa080bf8c..d346ac69e55 100644 --- a/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md @@ -8,6 +8,9 @@ semantic conventions. ([#5066](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5066)) +* Removed `netstandard2.1` target. + ([#5094](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5094)) + ## 1.6.0-beta.3 Released 2023-Nov-17 diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs b/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs index d2ea0e7f663..fcdf2e78cf6 100644 --- a/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs +++ b/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs @@ -344,51 +344,6 @@ static bool TryFetchException(object payload, out Exception exc) => ExceptionPropertyFetcher.TryFetch(payload, out exc) && exc != null; } - private static string GetUri(HttpRequest request) - { - // this follows the suggestions from https://github.com/dotnet/aspnetcore/issues/28906 - var scheme = request.Scheme ?? string.Empty; - - // HTTP 1.0 request with NO host header would result in empty Host. - // Use placeholder to avoid incorrect URL like "http:///" - var host = request.Host.Value ?? UnknownHostName; - var pathBase = request.PathBase.Value ?? string.Empty; - var path = request.Path.Value ?? string.Empty; - var queryString = request.QueryString.Value ?? string.Empty; - var length = scheme.Length + Uri.SchemeDelimiter.Length + host.Length + pathBase.Length - + path.Length + queryString.Length; - -#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER - return string.Create(length, (scheme, host, pathBase, path, queryString), (span, parts) => - { - CopyTo(ref span, parts.scheme); - CopyTo(ref span, Uri.SchemeDelimiter); - CopyTo(ref span, parts.host); - CopyTo(ref span, parts.pathBase); - CopyTo(ref span, parts.path); - CopyTo(ref span, parts.queryString); - - static void CopyTo(ref Span buffer, ReadOnlySpan text) - { - if (!text.IsEmpty) - { - text.CopyTo(buffer); - buffer = buffer.Slice(text.Length); - } - } - }); -#else - return new System.Text.StringBuilder(length) - .Append(scheme) - .Append(Uri.SchemeDelimiter) - .Append(host) - .Append(pathBase) - .Append(path) - .Append(queryString) - .ToString(); -#endif - } - #if !NETSTANDARD2_0 [MethodImpl(MethodImplOptions.AggressiveInlining)] private static bool TryGetGrpcMethod(Activity activity, out string grpcMethod)