From 6bd6d858e56c0640a586f72badc3dd8351558bdb Mon Sep 17 00:00:00 2001 From: Cijo Thomas Date: Fri, 22 Apr 2022 11:05:41 -0700 Subject: [PATCH] Remove NET5.0 target from OTLP Exporters --- .../{net5.0 => net6.0}/PublicAPI.Shipped.txt | 0 .../{net5.0 => net6.0}/PublicAPI.Unshipped.txt | 0 .../CHANGELOG.md | 6 ++++++ .../ExportClient/BaseOtlpGrpcExportClient.cs | 4 ++-- .../ExportClient/BaseOtlpHttpExportClient.cs | 2 +- .../ExportClient/OtlpHttpLogExportClient.cs | 4 ++-- .../ExportClient/OtlpHttpMetricsExportClient.cs | 4 ++-- .../ExportClient/OtlpHttpTraceExportClient.cs | 4 ++-- ...enTelemetry.Exporter.OpenTelemetryProtocol.csproj | 12 ++++++------ .../OtlpExporterOptionsExtensions.cs | 6 +++--- .../ExportClient/OtlpHttpTraceExportClientTests.cs | 4 ++-- ...metry.Exporter.OpenTelemetryProtocol.Tests.csproj | 2 +- .../OpenTelemetry.Exporter.Prometheus.Tests.csproj | 4 ---- .../OpenTelemetry.Instrumentation.Grpc.Tests.csproj | 2 +- 14 files changed, 28 insertions(+), 26 deletions(-) rename src/OpenTelemetry.Exporter.OpenTelemetryProtocol/.publicApi/{net5.0 => net6.0}/PublicAPI.Shipped.txt (100%) rename src/OpenTelemetry.Exporter.OpenTelemetryProtocol/.publicApi/{net5.0 => net6.0}/PublicAPI.Unshipped.txt (100%) diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/.publicApi/net5.0/PublicAPI.Shipped.txt b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/.publicApi/net6.0/PublicAPI.Shipped.txt similarity index 100% rename from src/OpenTelemetry.Exporter.OpenTelemetryProtocol/.publicApi/net5.0/PublicAPI.Shipped.txt rename to src/OpenTelemetry.Exporter.OpenTelemetryProtocol/.publicApi/net6.0/PublicAPI.Shipped.txt diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/.publicApi/net5.0/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/.publicApi/net6.0/PublicAPI.Unshipped.txt similarity index 100% rename from src/OpenTelemetry.Exporter.OpenTelemetryProtocol/.publicApi/net5.0/PublicAPI.Unshipped.txt rename to src/OpenTelemetry.Exporter.OpenTelemetryProtocol/.publicApi/net6.0/PublicAPI.Unshipped.txt diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md index 72c51b40b71..9b24b75040c 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md @@ -9,6 +9,12 @@ option ([#3224](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3224)) +* Removes net5.0 target and replaced with net6.0 + as .NET 5.0 is going out of support. + The package keeps netstandard2.1 target, so it + can still be used with .NET5.0 apps. + ([#3147](https://github.com/open-telemetry/opentelemetry-dotnet/issues/3147)) + ## 1.3.0-beta.1 Released 2022-Apr-15 diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/BaseOtlpGrpcExportClient.cs b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/BaseOtlpGrpcExportClient.cs index 49b60c1a97e..e67089ccec8 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/BaseOtlpGrpcExportClient.cs +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/BaseOtlpGrpcExportClient.cs @@ -19,7 +19,7 @@ using System.Threading.Tasks; using Grpc.Core; using OpenTelemetry.Internal; -#if NETSTANDARD2_1 || NET5_0_OR_GREATER +#if NETSTANDARD2_1 || NET6_0_OR_GREATER using Grpc.Net.Client; #endif @@ -41,7 +41,7 @@ protected BaseOtlpGrpcExportClient(OtlpExporterOptions options) this.TimeoutMilliseconds = options.TimeoutMilliseconds; } -#if NETSTANDARD2_1 || NET5_0_OR_GREATER +#if NETSTANDARD2_1 || NET6_0_OR_GREATER internal GrpcChannel Channel { get; set; } #else internal Channel Channel { get; set; } diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/BaseOtlpHttpExportClient.cs b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/BaseOtlpHttpExportClient.cs index d2fe60e2ebd..ffa708acaf7 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/BaseOtlpHttpExportClient.cs +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/BaseOtlpHttpExportClient.cs @@ -92,7 +92,7 @@ protected HttpRequestMessage CreateHttpRequest(TRequest exportRequest) protected HttpResponseMessage SendHttpRequest(HttpRequestMessage request, CancellationToken cancellationToken) { -#if NET5_0_OR_GREATER +#if NET6_0_OR_GREATER return this.HttpClient.Send(request, cancellationToken); #else return this.HttpClient.SendAsync(request, cancellationToken).GetAwaiter().GetResult(); diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpHttpLogExportClient.cs b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpHttpLogExportClient.cs index b30c199ca4c..683bd3ef331 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpHttpLogExportClient.cs +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpHttpLogExportClient.cs @@ -19,7 +19,7 @@ using System.Net.Http; using System.Net.Http.Headers; using System.Runtime.CompilerServices; -#if NET5_0_OR_GREATER +#if NET6_0_OR_GREATER using System.Threading; #endif using System.Threading.Tasks; @@ -56,7 +56,7 @@ public ExportRequestContent(OtlpCollector.ExportLogsServiceRequest exportRequest this.Headers.ContentType = ProtobufMediaTypeHeader; } -#if NET5_0_OR_GREATER +#if NET6_0_OR_GREATER protected override void SerializeToStream(Stream stream, TransportContext context, CancellationToken cancellationToken) { this.SerializeToStreamInternal(stream); diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpHttpMetricsExportClient.cs b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpHttpMetricsExportClient.cs index a9ca3f04ccf..e12b641a7f6 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpHttpMetricsExportClient.cs +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpHttpMetricsExportClient.cs @@ -19,7 +19,7 @@ using System.Net.Http; using System.Net.Http.Headers; using System.Runtime.CompilerServices; -#if NET5_0_OR_GREATER +#if NET6_0_OR_GREATER using System.Threading; #endif using System.Threading.Tasks; @@ -56,7 +56,7 @@ public ExportRequestContent(OtlpCollector.ExportMetricsServiceRequest exportRequ this.Headers.ContentType = ProtobufMediaTypeHeader; } -#if NET5_0_OR_GREATER +#if NET6_0_OR_GREATER protected override void SerializeToStream(Stream stream, TransportContext context, CancellationToken cancellationToken) { this.SerializeToStreamInternal(stream); diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpHttpTraceExportClient.cs b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpHttpTraceExportClient.cs index 75c959fc20a..e6ee70e3ece 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpHttpTraceExportClient.cs +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpHttpTraceExportClient.cs @@ -19,7 +19,7 @@ using System.Net.Http; using System.Net.Http.Headers; using System.Runtime.CompilerServices; -#if NET5_0_OR_GREATER +#if NET6_0_OR_GREATER using System.Threading; #endif using System.Threading.Tasks; @@ -56,7 +56,7 @@ public ExportRequestContent(OtlpCollector.ExportTraceServiceRequest exportReques this.Headers.ContentType = ProtobufMediaTypeHeader; } -#if NET5_0_OR_GREATER +#if NET6_0_OR_GREATER protected override void SerializeToStream(Stream stream, TransportContext context, CancellationToken cancellationToken) { this.SerializeToStreamInternal(stream); diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj index a355c3aaeb2..e01f6ec65b5 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj @@ -1,15 +1,15 @@ - + - net5.0;netstandard2.1;netstandard2.0;net462 + net6.0;netstandard2.1;netstandard2.0;net462 OpenTelemetry protocol exporter for OpenTelemetry .NET $(PackageTags);OTLP core- - - + + false @@ -17,7 +17,7 @@ - + diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptionsExtensions.cs b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptionsExtensions.cs index 7fee9f5a76f..9d99caf1714 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptionsExtensions.cs +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptionsExtensions.cs @@ -19,7 +19,7 @@ using System.Reflection; using Grpc.Core; using OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.ExportClient; -#if NETSTANDARD2_1 || NET5_0_OR_GREATER +#if NETSTANDARD2_1 || NET6_0_OR_GREATER using Grpc.Net.Client; #endif using LogOtlpCollector = Opentelemetry.Proto.Collector.Logs.V1; @@ -30,7 +30,7 @@ namespace OpenTelemetry.Exporter { internal static class OtlpExporterOptionsExtensions { -#if NETSTANDARD2_1 || NET5_0_OR_GREATER +#if NETSTANDARD2_1 || NET6_0_OR_GREATER public static GrpcChannel CreateChannel(this OtlpExporterOptions options) #else public static Channel CreateChannel(this OtlpExporterOptions options) @@ -41,7 +41,7 @@ public static Channel CreateChannel(this OtlpExporterOptions options) throw new NotSupportedException($"Endpoint URI scheme ({options.Endpoint.Scheme}) is not supported. Currently only \"http\" and \"https\" are supported."); } -#if NETSTANDARD2_1 || NET5_0_OR_GREATER +#if NETSTANDARD2_1 || NET6_0_OR_GREATER return GrpcChannel.ForAddress(options.Endpoint); #else ChannelCredentials channelCredentials; diff --git a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/Implementation/ExportClient/OtlpHttpTraceExportClientTests.cs b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/Implementation/ExportClient/OtlpHttpTraceExportClientTests.cs index 28b96084645..9bd02e00290 100644 --- a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/Implementation/ExportClient/OtlpHttpTraceExportClientTests.cs +++ b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/Implementation/ExportClient/OtlpHttpTraceExportClientTests.cs @@ -20,7 +20,7 @@ using System.Linq; using System.Net.Http; using System.Threading; -#if !NET5_0_OR_GREATER +#if !NET6_0_OR_GREATER using System.Threading.Tasks; #endif using Moq; @@ -98,7 +98,7 @@ public void SendExportRequest_ExportTraceServiceRequest_SendsCorrectHttpRequest( var httpRequestContent = Array.Empty(); httpHandlerMock.Protected() -#if NET5_0_OR_GREATER +#if NET6_0_OR_GREATER .Setup("Send", ItExpr.IsAny(), ItExpr.IsAny()) .Returns((HttpRequestMessage request, CancellationToken token) => { diff --git a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj index 84deb4f7128..bc0829061d4 100644 --- a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj +++ b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj @@ -2,7 +2,7 @@ - net6.0;net5.0;netcoreapp3.1 + net6.0;netcoreapp3.1 $(TargetFrameworks);net462 $(TARGET_FRAMEWORK) false diff --git a/test/OpenTelemetry.Exporter.Prometheus.Tests/OpenTelemetry.Exporter.Prometheus.Tests.csproj b/test/OpenTelemetry.Exporter.Prometheus.Tests/OpenTelemetry.Exporter.Prometheus.Tests.csproj index cbed29404a7..e3ff74abad7 100644 --- a/test/OpenTelemetry.Exporter.Prometheus.Tests/OpenTelemetry.Exporter.Prometheus.Tests.csproj +++ b/test/OpenTelemetry.Exporter.Prometheus.Tests/OpenTelemetry.Exporter.Prometheus.Tests.csproj @@ -29,10 +29,6 @@ - - - - diff --git a/test/OpenTelemetry.Instrumentation.Grpc.Tests/OpenTelemetry.Instrumentation.Grpc.Tests.csproj b/test/OpenTelemetry.Instrumentation.Grpc.Tests/OpenTelemetry.Instrumentation.Grpc.Tests.csproj index 38c8b0274a4..726e5198379 100644 --- a/test/OpenTelemetry.Instrumentation.Grpc.Tests/OpenTelemetry.Instrumentation.Grpc.Tests.csproj +++ b/test/OpenTelemetry.Instrumentation.Grpc.Tests/OpenTelemetry.Instrumentation.Grpc.Tests.csproj @@ -2,7 +2,7 @@ Unit test project for OpenTelemetry Grpc for .NET instrumentation - net6.0;net5.0;netcoreapp3.1 + net6.0;netcoreapp3.1