From b0e27ce7f0e2615eadeaa4b401c108c536b94c18 Mon Sep 17 00:00:00 2001 From: Cijo Thomas Date: Mon, 19 Jul 2021 23:16:46 -0700 Subject: [PATCH] Remove Net452 from API project --- .../.publicApi/net452/PublicAPI.Unshipped.txt | 0 .../{net452 => net461}/PublicAPI.Shipped.txt | 0 .../.publicApi/net461/PublicAPI.Unshipped.txt | 4 +++ src/OpenTelemetry.Api/CHANGELOG.md | 3 +++ .../Context/AsyncLocalRuntimeContextSlot.cs | 2 -- .../Context/RemotingRuntimeContextSlot.cs | 2 +- .../Context/RuntimeContext.cs | 4 --- .../OpenTelemetry.Api.csproj | 8 +++++- .../OpenTelemetry.Exporter.Zipkin.csproj | 2 +- .../ZipkinExporter.cs | 25 ------------------- .../ZipkinExporterOptions.cs | 4 --- 11 files changed, 16 insertions(+), 38 deletions(-) delete mode 100644 src/OpenTelemetry.Api/.publicApi/net452/PublicAPI.Unshipped.txt rename src/OpenTelemetry.Api/.publicApi/{net452 => net461}/PublicAPI.Shipped.txt (100%) create mode 100644 src/OpenTelemetry.Api/.publicApi/net461/PublicAPI.Unshipped.txt diff --git a/src/OpenTelemetry.Api/.publicApi/net452/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Api/.publicApi/net452/PublicAPI.Unshipped.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/OpenTelemetry.Api/.publicApi/net452/PublicAPI.Shipped.txt b/src/OpenTelemetry.Api/.publicApi/net461/PublicAPI.Shipped.txt similarity index 100% rename from src/OpenTelemetry.Api/.publicApi/net452/PublicAPI.Shipped.txt rename to src/OpenTelemetry.Api/.publicApi/net461/PublicAPI.Shipped.txt diff --git a/src/OpenTelemetry.Api/.publicApi/net461/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Api/.publicApi/net461/PublicAPI.Unshipped.txt new file mode 100644 index 00000000000..edd1a3f6ec6 --- /dev/null +++ b/src/OpenTelemetry.Api/.publicApi/net461/PublicAPI.Unshipped.txt @@ -0,0 +1,4 @@ +override OpenTelemetry.Context.AsyncLocalRuntimeContextSlot.Get() -> T +override OpenTelemetry.Context.AsyncLocalRuntimeContextSlot.Set(T value) -> void +OpenTelemetry.Context.AsyncLocalRuntimeContextSlot +OpenTelemetry.Context.AsyncLocalRuntimeContextSlot.AsyncLocalRuntimeContextSlot(string name) -> void diff --git a/src/OpenTelemetry.Api/CHANGELOG.md b/src/OpenTelemetry.Api/CHANGELOG.md index 6f68c7e29e8..c14b144e382 100644 --- a/src/OpenTelemetry.Api/CHANGELOG.md +++ b/src/OpenTelemetry.Api/CHANGELOG.md @@ -9,6 +9,9 @@ please check the latest changes ## Unreleased +* Removes .NET Framework 4.5.2 support. The minimum .NET Framework + version supported is .NET 4.6.1. ([#2138](https://github.com/open-telemetry/opentelemetry-dotnet/issues/2138)) + ## 1.1.0 Released 2021-Jul-12 diff --git a/src/OpenTelemetry.Api/Context/AsyncLocalRuntimeContextSlot.cs b/src/OpenTelemetry.Api/Context/AsyncLocalRuntimeContextSlot.cs index abfce0c564e..de5c5083a13 100644 --- a/src/OpenTelemetry.Api/Context/AsyncLocalRuntimeContextSlot.cs +++ b/src/OpenTelemetry.Api/Context/AsyncLocalRuntimeContextSlot.cs @@ -14,7 +14,6 @@ // limitations under the License. // -#if !NET452 using System.Runtime.CompilerServices; using System.Threading; @@ -53,4 +52,3 @@ public override void Set(T value) } } } -#endif diff --git a/src/OpenTelemetry.Api/Context/RemotingRuntimeContextSlot.cs b/src/OpenTelemetry.Api/Context/RemotingRuntimeContextSlot.cs index 277b6e61fdf..f589d9900bc 100644 --- a/src/OpenTelemetry.Api/Context/RemotingRuntimeContextSlot.cs +++ b/src/OpenTelemetry.Api/Context/RemotingRuntimeContextSlot.cs @@ -14,7 +14,7 @@ // limitations under the License. // -#if NET452 +#if NET461 using System.Collections; using System.Reflection; using System.Runtime.CompilerServices; diff --git a/src/OpenTelemetry.Api/Context/RuntimeContext.cs b/src/OpenTelemetry.Api/Context/RuntimeContext.cs index 47e48c65a8a..b0110e5ac3c 100644 --- a/src/OpenTelemetry.Api/Context/RuntimeContext.cs +++ b/src/OpenTelemetry.Api/Context/RuntimeContext.cs @@ -30,11 +30,7 @@ public static class RuntimeContext /// /// Gets or sets the actual context carrier implementation. /// -#if !NET452 public static Type ContextSlotType { get; set; } = typeof(AsyncLocalRuntimeContextSlot<>); -#else - public static Type ContextSlotType { get; set; } = typeof(RemotingRuntimeContextSlot<>); -#endif /// /// Register a named context slot. diff --git a/src/OpenTelemetry.Api/OpenTelemetry.Api.csproj b/src/OpenTelemetry.Api/OpenTelemetry.Api.csproj index a71a29946db..d5d3e19631f 100644 --- a/src/OpenTelemetry.Api/OpenTelemetry.Api.csproj +++ b/src/OpenTelemetry.Api/OpenTelemetry.Api.csproj @@ -1,6 +1,6 @@  - netstandard2.0;net452 + netstandard2.0;net461 OpenTelemetry .NET API OpenTelemetry @@ -8,6 +8,12 @@ core- + + + false + + diff --git a/src/OpenTelemetry.Exporter.Zipkin/OpenTelemetry.Exporter.Zipkin.csproj b/src/OpenTelemetry.Exporter.Zipkin/OpenTelemetry.Exporter.Zipkin.csproj index 51e3ac63329..bd6cfc37423 100644 --- a/src/OpenTelemetry.Exporter.Zipkin/OpenTelemetry.Exporter.Zipkin.csproj +++ b/src/OpenTelemetry.Exporter.Zipkin/OpenTelemetry.Exporter.Zipkin.csproj @@ -22,7 +22,7 @@ - + diff --git a/src/OpenTelemetry.Exporter.Zipkin/ZipkinExporter.cs b/src/OpenTelemetry.Exporter.Zipkin/ZipkinExporter.cs index 43f389ded2d..08e5530bae5 100644 --- a/src/OpenTelemetry.Exporter.Zipkin/ZipkinExporter.cs +++ b/src/OpenTelemetry.Exporter.Zipkin/ZipkinExporter.cs @@ -22,11 +22,7 @@ using System.Net.Http; using System.Net.Http.Headers; using System.Net.Sockets; -#if NET452 -using Newtonsoft.Json; -#else using System.Text.Json; -#endif using System.Threading; using System.Threading.Tasks; using OpenTelemetry.Exporter.Zipkin.Implementation; @@ -40,9 +36,7 @@ namespace OpenTelemetry.Exporter public class ZipkinExporter : BaseExporter { private readonly ZipkinExporterOptions options; -#if !NET452 private readonly int maxPayloadSizeInBytes; -#endif private readonly HttpClient httpClient; /// @@ -53,9 +47,7 @@ public class ZipkinExporter : BaseExporter public ZipkinExporter(ZipkinExporterOptions options, HttpClient client = null) { this.options = options ?? throw new ArgumentNullException(nameof(options)); -#if !NET452 this.maxPayloadSizeInBytes = (!options.MaxPayloadSizeInBytes.HasValue || options.MaxPayloadSizeInBytes <= 0) ? ZipkinExporterOptions.DefaultMaxPayloadSizeInBytes : options.MaxPayloadSizeInBytes.Value; -#endif this.httpClient = client ?? new HttpClient(); } @@ -196,12 +188,7 @@ private class JsonContent : HttpContent private readonly ZipkinExporter exporter; private readonly Batch batch; - -#if NET452 - private JsonWriter writer; -#else private Utf8JsonWriter writer; -#endif public JsonContent(ZipkinExporter exporter, in Batch batch) { @@ -213,10 +200,6 @@ public JsonContent(ZipkinExporter exporter, in Batch batch) protected override Task SerializeToStreamAsync(Stream stream, TransportContext context) { -#if NET452 - StreamWriter streamWriter = new StreamWriter(stream); - this.writer = new JsonTextWriter(streamWriter); -#else if (this.writer == null) { this.writer = new Utf8JsonWriter(stream); @@ -225,7 +208,6 @@ protected override Task SerializeToStreamAsync(Stream stream, TransportContext c { this.writer.Reset(stream); } -#endif this.writer.WriteStartArray(); @@ -236,23 +218,16 @@ protected override Task SerializeToStreamAsync(Stream stream, TransportContext c zipkinSpan.Write(this.writer); zipkinSpan.Return(); -#if !NET452 if (this.writer.BytesPending >= this.exporter.maxPayloadSizeInBytes) { this.writer.Flush(); } -#endif } this.writer.WriteEndArray(); this.writer.Flush(); - -#if NET452 - return Task.FromResult(true); -#else return Task.CompletedTask; -#endif } protected override bool TryComputeLength(out long length) diff --git a/src/OpenTelemetry.Exporter.Zipkin/ZipkinExporterOptions.cs b/src/OpenTelemetry.Exporter.Zipkin/ZipkinExporterOptions.cs index 53ed4c73f83..ea19973fd42 100644 --- a/src/OpenTelemetry.Exporter.Zipkin/ZipkinExporterOptions.cs +++ b/src/OpenTelemetry.Exporter.Zipkin/ZipkinExporterOptions.cs @@ -24,9 +24,7 @@ namespace OpenTelemetry.Exporter /// public sealed class ZipkinExporterOptions { -#if !NET452 internal const int DefaultMaxPayloadSizeInBytes = 4096; -#endif /// /// Gets or sets Zipkin endpoint address. See https://zipkin.io/zipkin-api/#/default/post_spans. @@ -39,12 +37,10 @@ public sealed class ZipkinExporterOptions /// public bool UseShortTraceIds { get; set; } -#if !NET452 /// /// Gets or sets the maximum payload size in bytes. Default value: 4096. /// public int? MaxPayloadSizeInBytes { get; set; } = DefaultMaxPayloadSizeInBytes; -#endif /// /// Gets or sets the export processor type to be used with Zipkin Exporter.