Skip to content

Commit 86c1d8c

Browse files
KielekCodeBlanch
andauthored
[repo] Simplify preprocessor directives after dropping support for .NET 6 and .NET7 (open-telemetry#5851)
Co-authored-by: Mikel Blanchard <[email protected]>
1 parent b941f1e commit 86c1d8c

19 files changed

+45
-45
lines changed

src/OpenTelemetry.Api/Logs/LogRecordAttributeList.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using System.Collections;
77
using System.ComponentModel;
88
using System.Diagnostics;
9-
#if NET8_0_OR_GREATER && EXPOSE_EXPERIMENTAL_FEATURES
9+
#if NET && EXPOSE_EXPERIMENTAL_FEATURES
1010
using System.Diagnostics.CodeAnalysis;
1111
#endif
1212
using OpenTelemetry.Internal;
@@ -19,7 +19,7 @@ namespace OpenTelemetry.Logs;
1919
/// Stores attributes to be added to a log message.
2020
/// </summary>
2121
/// <remarks><inheritdoc cref="Logger" path="/remarks"/></remarks>
22-
#if NET8_0_OR_GREATER
22+
#if NET
2323
[Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
2424
#endif
2525
public

src/OpenTelemetry.Api/Logs/LogRecordData.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#nullable enable
55

66
using System.Diagnostics;
7-
#if NET8_0_OR_GREATER && EXPOSE_EXPERIMENTAL_FEATURES
7+
#if NET && EXPOSE_EXPERIMENTAL_FEATURES
88
using System.Diagnostics.CodeAnalysis;
99
using OpenTelemetry.Internal;
1010
#endif
@@ -16,7 +16,7 @@ namespace OpenTelemetry.Logs;
1616
/// Stores details about a log message.
1717
/// </summary>
1818
/// <remarks><inheritdoc cref="Logger" path="/remarks"/></remarks>
19-
#if NET8_0_OR_GREATER
19+
#if NET
2020
[Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
2121
#endif
2222
public

src/OpenTelemetry.Api/Logs/LogRecordSeverity.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#nullable enable
55

6-
#if NET8_0_OR_GREATER && EXPOSE_EXPERIMENTAL_FEATURES
6+
#if NET && EXPOSE_EXPERIMENTAL_FEATURES
77
using System.Diagnostics.CodeAnalysis;
88
using OpenTelemetry.Internal;
99
#endif
@@ -15,7 +15,7 @@ namespace OpenTelemetry.Logs;
1515
/// Describes the severity level of a log record.
1616
/// </summary>
1717
/// <remarks><inheritdoc cref="Logger" path="/remarks"/></remarks>
18-
#if NET8_0_OR_GREATER
18+
#if NET
1919
[Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
2020
#endif
2121
public

src/OpenTelemetry.Api/Logs/LogRecordSeverityExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#nullable enable
55

6-
#if NET8_0_OR_GREATER && EXPOSE_EXPERIMENTAL_FEATURES
6+
#if NET && EXPOSE_EXPERIMENTAL_FEATURES
77
using System.Diagnostics.CodeAnalysis;
88
using OpenTelemetry.Internal;
99
#endif
@@ -15,7 +15,7 @@ namespace OpenTelemetry.Logs;
1515
/// Contains extension methods for the <see cref="LogRecordSeverity"/> enum.
1616
/// </summary>
1717
/// <remarks><inheritdoc cref="Logger" path="/remarks"/></remarks>
18-
#if NET8_0_OR_GREATER
18+
#if NET
1919
[Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
2020
#endif
2121
public

src/OpenTelemetry.Api/Logs/Logger.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#nullable enable
55

6-
#if NET8_0_OR_GREATER && EXPOSE_EXPERIMENTAL_FEATURES
6+
#if NET && EXPOSE_EXPERIMENTAL_FEATURES
77
using System.Diagnostics.CodeAnalysis;
88
using OpenTelemetry.Internal;
99
#endif
@@ -15,7 +15,7 @@ namespace OpenTelemetry.Logs;
1515
/// Logger is the class responsible for creating log records.
1616
/// </summary>
1717
/// <remarks><b>WARNING</b>: This is an experimental API which might change or be removed in the future. Use at your own risk.</remarks>
18-
#if NET8_0_OR_GREATER
18+
#if NET
1919
[Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
2020
#endif
2121
public

src/OpenTelemetry.Api/Logs/LoggerProvider.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#if NETSTANDARD2_1_OR_GREATER || NET
77
using System.Diagnostics.CodeAnalysis;
88
#endif
9-
#if EXPOSE_EXPERIMENTAL_FEATURES && NET8_0_OR_GREATER
9+
#if EXPOSE_EXPERIMENTAL_FEATURES && NET
1010
using OpenTelemetry.Internal;
1111
#endif
1212

@@ -32,7 +32,7 @@ protected LoggerProvider()
3232
/// </summary>
3333
/// <remarks><inheritdoc cref="Logger" path="/remarks"/></remarks>
3434
/// <returns><see cref="Logger"/> instance.</returns>
35-
#if NET8_0_OR_GREATER
35+
#if NET
3636
[Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
3737
#endif
3838
public
@@ -49,7 +49,7 @@ Logger GetLogger()
4949
/// <remarks><inheritdoc cref="Logger" path="/remarks"/></remarks>
5050
/// <param name="name">Optional name identifying the instrumentation library.</param>
5151
/// <returns><see cref="Logger"/> instance.</returns>
52-
#if NET8_0_OR_GREATER
52+
#if NET
5353
[Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
5454
#endif
5555
public
@@ -67,7 +67,7 @@ Logger GetLogger(string? name)
6767
/// <param name="name">Optional name identifying the instrumentation library.</param>
6868
/// <param name="version">Optional version of the instrumentation library.</param>
6969
/// <returns><see cref="Logger"/> instance.</returns>
70-
#if NET8_0_OR_GREATER
70+
#if NET
7171
[Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
7272
#endif
7373
public
@@ -94,7 +94,7 @@ Logger GetLogger(string? name, string? version)
9494
/// <param name="name">Optional name identifying the instrumentation library.</param>
9595
/// <param name="logger"><see cref="Logger"/>.</param>
9696
/// <returns><see langword="true"/> if the logger was created.</returns>
97-
#if NET8_0_OR_GREATER
97+
#if NET
9898
[Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
9999
#endif
100100
protected

src/OpenTelemetry.Exporter.Prometheus.AspNetCore/PrometheusExporterMiddleware.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public async Task InvokeAsync(HttpContext httpContext)
6565
if (dataView.Count > 0)
6666
{
6767
response.StatusCode = 200;
68-
#if NET8_0_OR_GREATER
68+
#if NET
6969
response.Headers.Append("Last-Modified", collectionResponse.GeneratedAtUtc.ToString("R"));
7070
#else
7171
response.Headers.Add("Last-Modified", collectionResponse.GeneratedAtUtc.ToString("R"));

src/OpenTelemetry/Logs/ILogger/OpenTelemetryLoggingExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public static ILoggingBuilder AddOpenTelemetry(
7171
/// </remarks>
7272
/// <param name="builder">The <see cref="ILoggingBuilder"/> to use.</param>
7373
/// <returns>The supplied <see cref="ILoggingBuilder"/> for call chaining.</returns>
74-
#if NET8_0_OR_GREATER
74+
#if NET
7575
[Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
7676
#endif
7777
public
@@ -90,7 +90,7 @@ static ILoggingBuilder UseOpenTelemetry(
9090
/// <param name="builder">The <see cref="ILoggingBuilder"/> to use.</param>
9191
/// <param name="configure"><see cref="LoggerProviderBuilder"/> configuration action.</param>
9292
/// <returns>The supplied <see cref="ILoggingBuilder"/> for call chaining.</returns>
93-
#if NET8_0_OR_GREATER
93+
#if NET
9494
[Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
9595
#endif
9696
public
@@ -115,7 +115,7 @@ static ILoggingBuilder UseOpenTelemetry(
115115
/// <param name="configureBuilder">Optional <see cref="LoggerProviderBuilder"/> configuration action.</param>
116116
/// <param name="configureOptions">Optional <see cref="OpenTelemetryLoggerOptions"/> configuration action.</param>
117117
/// <returns>The supplied <see cref="ILoggingBuilder"/> for call chaining.</returns>
118-
#if NET8_0_OR_GREATER
118+
#if NET
119119
[Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
120120
#endif
121121
public

src/OpenTelemetry/Logs/LogRecord.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
using System.Diagnostics;
5-
#if EXPOSE_EXPERIMENTAL_FEATURES && NET8_0_OR_GREATER
5+
#if EXPOSE_EXPERIMENTAL_FEATURES && NET
66
using System.Diagnostics.CodeAnalysis;
77
#endif
88
using System.Runtime.CompilerServices;
@@ -355,7 +355,7 @@ public Exception? Exception
355355
/// known at the source.
356356
/// </summary>
357357
/// <remarks><inheritdoc cref="Sdk.CreateLoggerProviderBuilder" path="/remarks"/></remarks>
358-
#if NET8_0_OR_GREATER
358+
#if NET
359359
[Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
360360
#endif
361361
public
@@ -377,7 +377,7 @@ public Exception? Exception
377377
/// Gets or sets the log <see cref="LogRecordSeverity"/>.
378378
/// </summary>
379379
/// <remarks><inheritdoc cref="Sdk.CreateLoggerProviderBuilder" path="/remarks"/></remarks>
380-
#if NET8_0_OR_GREATER
380+
#if NET
381381
[Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
382382
#endif
383383
public
@@ -405,7 +405,7 @@ public Exception? Exception
405405
/// typically the <see cref="Logs.Logger"/> which emitted the <see
406406
/// cref="LogRecord"/> however the value may be different if <see
407407
/// cref="CategoryName"/> is modified.</remarks>
408-
#if NET8_0_OR_GREATER
408+
#if NET
409409
[Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
410410
#endif
411411
public Logger Logger { get; internal set; } = InstrumentationScopeLogger.Default;

src/OpenTelemetry/Metrics/AggregatorStore.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
using System.Collections.Concurrent;
5-
#if NET8_0_OR_GREATER
5+
#if NET
66
using System.Collections.Frozen;
77
#endif
88
using System.Diagnostics;
@@ -14,7 +14,7 @@ namespace OpenTelemetry.Metrics;
1414

1515
internal sealed class AggregatorStore
1616
{
17-
#if NET8_0_OR_GREATER
17+
#if NET
1818
internal readonly FrozenSet<string>? TagKeysInteresting;
1919
#else
2020
internal readonly HashSet<string>? TagKeysInteresting;
@@ -96,7 +96,7 @@ internal AggregatorStore(
9696
{
9797
this.updateLongCallback = this.UpdateLongCustomTags;
9898
this.updateDoubleCallback = this.UpdateDoubleCustomTags;
99-
#if NET8_0_OR_GREATER
99+
#if NET
100100
var hs = FrozenSet.ToFrozenSet(metricStreamIdentity.TagKeys, StringComparer.Ordinal);
101101
#else
102102
var hs = new HashSet<string>(metricStreamIdentity.TagKeys, StringComparer.Ordinal);

0 commit comments

Comments
 (0)