Skip to content
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

Remove NET5.0 target from OTLP Exporters #3226

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>net5.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>
<TargetFrameworks>net6.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>
<Description>OpenTelemetry protocol exporter for OpenTelemetry .NET</Description>
<PackageTags>$(PackageTags);OTLP</PackageTags>
<MinVerTagPrefix>core-</MinVerTagPrefix>
</PropertyGroup>

<!--Do not run ApiCompat for net462 as this is newly added. There is no existing contract for net462 against which we could compare the implementation.
Remove this property once we have released a stable net462 version.-->
<PropertyGroup Condition="'$(TargetFramework)' == 'net462'">
<!--Do not run ApiCompat for net462/net6.0 as this is newly added. There is no existing contract for net462 against which we could compare the implementation.
Remove this property once we have released a stable net462/net6.0 version.-->
<PropertyGroup Condition="'$(TargetFramework)' == 'net462' OR '$(TargetFramework)' == 'net6.0'">
<RunApiCompat>false</RunApiCompat>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="Grpc.Net.Client" Version="$(GrpcNetClientPkgVer)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Grpc.Net.Client" Version="$(GrpcNetClientPkgVer)" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -98,7 +98,7 @@ public void SendExportRequest_ExportTraceServiceRequest_SendsCorrectHttpRequest(
var httpRequestContent = Array.Empty<byte>();

httpHandlerMock.Protected()
#if NET5_0_OR_GREATER
#if NET6_0_OR_GREATER
.Setup<HttpResponseMessage>("Send", ItExpr.IsAny<HttpRequestMessage>(), ItExpr.IsAny<CancellationToken>())
.Returns((HttpRequestMessage request, CancellationToken token) =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) == ''">net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) == ''">net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) == '' AND $(OS) == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) != ''">$(TARGET_FRAMEWORK)</TargetFrameworks>
<IsPackable>false</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="5.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="3.1.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<Description>Unit test project for OpenTelemetry Grpc for .NET instrumentation</Description>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down