Skip to content

Commit 20beb10

Browse files
Now that we can use vendored Span<> type in our library, enable the new Traces http/protobuf implementation to run on all runtimes. This also removes the '#if NETCOREAPP3_1_OR_GREATER' from the vendored OpenTelemetry .NET SDK ProtobufSerializer
1 parent 3b6af8d commit 20beb10

9 files changed

Lines changed: 0 additions & 52 deletions

File tree

tracer/src/Datadog.Trace/Agent/AgentWriter.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ internal AgentWriter(IApi api, IStatsAggregator? statsAggregator, IStatsdManager
9797
ISpanBufferSerializer CreateSpanSerializer() => api.TracesEncoding switch
9898
{
9999
TracesEncoding.OtlpJson => new OtlpTracesJsonSerializer(),
100-
#if NETCOREAPP3_1_OR_GREATER
101100
TracesEncoding.OtlpProtobuf => new OpenTelemetry.Traces.OtlpTracesProtobufSerializer(),
102-
#endif
103101
_ => new SpanBufferMessagePackSerializer(SpanFormatterResolver.Instance),
104102
};
105103

tracer/src/Datadog.Trace/OpenTelemetry/Stubs/OpenTelemetryProtocolExporterEventSource.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// </copyright>
55

66
#nullable enable
7-
#if NETCOREAPP3_1_OR_GREATER
87

98
using System;
109

@@ -88,4 +87,3 @@ public void BufferResizeFailedDueToMemory(string signalType)
8887
}
8988
}
9089
}
91-
#endif

tracer/src/Datadog.Trace/OpenTelemetry/Stubs/OtlpSignalType.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// </copyright>
55

66
#nullable enable
7-
#if NETCOREAPP3_1_OR_GREATER
87

98
namespace Datadog.Trace.Vendors.OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.Serializer
109
{
@@ -35,6 +34,3 @@ internal enum OtlpSignalType
3534
Logs = 3,
3635
}
3736
}
38-
39-
#endif
40-

tracer/src/Datadog.Trace/OpenTelemetry/Traces/OtlpTracesProtobufSerializer.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
44
// </copyright>
55

6-
#if NETCOREAPP3_1_OR_GREATER
7-
86
using System;
9-
using System.Buffers.Binary;
107
using Datadog.Trace.Agent;
118
using Datadog.Trace.Agent.MessagePack;
129
using Datadog.Trace.OpenTelemetry.Common;
@@ -488,5 +485,3 @@ private static void WriteHexBytes(byte[] bytes, int writePosition, string hex, i
488485
};
489486
}
490487
}
491-
492-
#endif

tracer/src/Datadog.Trace/Vendors/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/Serializer/ProtobufOtlpCommonFieldNumberConstants.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,9 @@
44
//------------------------------------------------------------------------------
55
#pragma warning disable CS0618, CS0649, CS1574, CS1580, CS1581, CS1584, CS1591, CS1573, CS8018, SYSLIB0011, SYSLIB0023, SYSLIB0032
66
#nullable enable
7-
#if NETCOREAPP3_1_OR_GREATER
87
// Copyright The OpenTelemetry Authors
98
// SPDX-License-Identifier: Apache-2.0
109

11-
using System;
12-
using System.Collections.Generic;
13-
using System.IO;
14-
using System.Linq;
15-
using System.Net.Http;
16-
using System.Threading;
17-
using System.Threading.Tasks;
18-
1910
namespace Datadog.Trace.Vendors.OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.Serializer;
2011

2112
/// <summary>
@@ -45,5 +36,3 @@ internal static class ProtobufOtlpCommonFieldNumberConstants
4536

4637
internal const int ArrayValue_Value = 1;
4738
}
48-
49-
#endif

tracer/src/Datadog.Trace/Vendors/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/Serializer/ProtobufOtlpTraceFieldNumberConstants.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,9 @@
44
//------------------------------------------------------------------------------
55
#pragma warning disable CS0618, CS0649, CS1574, CS1580, CS1581, CS1584, CS1591, CS1573, CS8018, SYSLIB0011, SYSLIB0023, SYSLIB0032
66
#nullable enable
7-
#if NETCOREAPP3_1_OR_GREATER
87
// Copyright The OpenTelemetry Authors
98
// SPDX-License-Identifier: Apache-2.0
109

11-
using System;
12-
using System.Collections.Generic;
13-
using System.IO;
14-
using System.Linq;
15-
using System.Net.Http;
16-
using System.Threading;
17-
using System.Threading.Tasks;
18-
1910
namespace Datadog.Trace.Vendors.OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.Serializer;
2011

2112
/// <summary>
@@ -86,5 +77,3 @@ internal static class ProtobufOtlpTraceFieldNumberConstants
8677
internal const int Status_Code_Ok = 1;
8778
internal const int Status_Code_Error = 2;
8879
}
89-
90-
#endif

tracer/src/Datadog.Trace/Vendors/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/Serializer/ProtobufSerializer.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
//------------------------------------------------------------------------------
55
#pragma warning disable CS0618, CS0649, CS1574, CS1580, CS1581, CS1584, CS1591, CS1573, CS8018, SYSLIB0011, SYSLIB0023, SYSLIB0032
66
#nullable enable
7-
#if NETCOREAPP3_1_OR_GREATER
87
// Copyright The OpenTelemetry Authors
98
// SPDX-License-Identifier: Apache-2.0
109

11-
using System.Buffers.Binary;
1210
using System.Diagnostics;
1311
using System.Runtime.CompilerServices;
1412
#if NETFRAMEWORK || NETSTANDARD2_0
@@ -20,7 +18,6 @@
2018
using System.Collections.Generic;
2119
using System.IO;
2220
using System.Linq;
23-
using System.Net.Http;
2421
using System.Threading;
2522
using System.Threading.Tasks;
2623

@@ -353,5 +350,3 @@ private static unsafe ref T GetNonNullPinnableReference<T>(ReadOnlySpan<T> span)
353350
=> ref (span.Length != 0) ? ref Unsafe.AsRef(in MemoryMarshal.GetReference(span)) : ref Unsafe.AsRef<T>((void*)1);
354351
#endif
355352
}
356-
357-
#endif

tracer/src/Datadog.Trace/Vendors/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/Serializer/ProtobufWireType.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,9 @@
44
//------------------------------------------------------------------------------
55
#pragma warning disable CS0618, CS0649, CS1574, CS1580, CS1581, CS1584, CS1591, CS1573, CS8018, SYSLIB0011, SYSLIB0023, SYSLIB0032
66
#nullable enable
7-
#if NETCOREAPP3_1_OR_GREATER
87
// Copyright The OpenTelemetry Authors
98
// SPDX-License-Identifier: Apache-2.0
109

11-
using System;
12-
using System.Collections.Generic;
13-
using System.IO;
14-
using System.Linq;
15-
using System.Net.Http;
16-
using System.Threading;
17-
using System.Threading.Tasks;
1810

1911
namespace Datadog.Trace.Vendors.OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.Serializer;
2012

@@ -60,5 +52,3 @@ internal enum ProtobufWireType : uint
6052
/// </summary>
6153
I32 = 5,
6254
}
63-
64-
#endif

tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/OpenTelemetrySdkTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ public async Task IntegrationDisabled(string packageVersion)
231231
}
232232
}
233233

234-
#if NET6_0_OR_GREATER
235234
[SkippableTheory]
236235
[Trait("Category", "EndToEnd")]
237236
[MemberData(nameof(GetOtlpTracesTestData))]
@@ -531,7 +530,6 @@ await Verifier.Verify(finalJson, settings)
531530
.DisableRequireUniquePrefix();
532531
}
533532
}
534-
#endif
535533

536534
#if NET6_0_OR_GREATER
537535
[SkippableTheory]

0 commit comments

Comments
 (0)