diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/HttpHandler.cs b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/HttpHandler.cs index 70e7a0597c1..e59649e8db8 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/HttpHandler.cs +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/HttpHandler.cs @@ -47,9 +47,11 @@ public void Dispose() public HttpResponseMessage Send(HttpRequestMessage request, CancellationToken cancellationToken) { - // TODO: replace by synchronous vesrion of Send method when it becomes availabe. - // See https://github.com/dotnet/runtime/pull/34948 (should be available starting form .NET 5.0). +#if NET5_0 + return this.HttpClient.Send(request); +#else return AsyncHelper.RunSync(() => this.HttpClient.SendAsync(request)); +#endif } } } diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj index 72de9c3ee33..74ff9b54146 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj @@ -1,6 +1,6 @@  - netstandard2.0;netstandard2.1;net461 + netstandard2.0;netstandard2.1;net461;net5.0 OpenTelemetry protocol exporter for OpenTelemetry .NET $(PackageTags);OTLP core- diff --git a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpHttpTraceExporterTests.cs b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpHttpTraceExporterTests.cs index 40e54d6e9e7..a3f2db4de8d 100644 --- a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpHttpTraceExporterTests.cs +++ b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpHttpTraceExporterTests.cs @@ -47,7 +47,7 @@ static OtlpHttpTraceExporterTests() } [Fact] - public void OtlpExporter_BadArgs() + public void AddOtlpHttpExporter_BadArgs_Throws() { TracerProviderBuilder builder = null; Assert.Throws(() => builder.AddOtlpHttpExporter());