From ffc17408fdcf734e878025b0d57982e806308072 Mon Sep 17 00:00:00 2001 From: Mikel Blanchard Date: Mon, 11 Dec 2023 15:17:36 -0800 Subject: [PATCH] [exporter-logs] Add ExperimentalAttribute decorations for experimental APIs (#5155) --- .../ConsoleExporterLoggingExtensions.cs | 12 ++++++++++++ .../OpenTelemetry.Exporter.Console.csproj | 1 + .../InMemoryExporterLoggingExtensions.cs | 6 ++++++ .../OpenTelemetry.Exporter.InMemory.csproj | 5 +++-- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/OpenTelemetry.Exporter.Console/ConsoleExporterLoggingExtensions.cs b/src/OpenTelemetry.Exporter.Console/ConsoleExporterLoggingExtensions.cs index afd5a15a3a..6b024498cb 100644 --- a/src/OpenTelemetry.Exporter.Console/ConsoleExporterLoggingExtensions.cs +++ b/src/OpenTelemetry.Exporter.Console/ConsoleExporterLoggingExtensions.cs @@ -1,6 +1,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#if EXPOSE_EXPERIMENTAL_FEATURES && NET8_0_OR_GREATER +using System.Diagnostics.CodeAnalysis; +#endif using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using OpenTelemetry.Exporter; @@ -42,6 +45,9 @@ public static OpenTelemetryLoggerOptions AddConsoleExporter(this OpenTelemetryLo /// WARNING: This is an experimental API which might change or be removed in the future. Use at your own risk. /// . /// The supplied instance of to chain the calls. +#if NET8_0_OR_GREATER + [Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)] +#endif public #else /// @@ -63,6 +69,9 @@ static LoggerProviderBuilder AddConsoleExporter( /// . /// Callback action for configuring . /// The supplied instance of to chain the calls. +#if NET8_0_OR_GREATER + [Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)] +#endif public #else /// @@ -87,6 +96,9 @@ static LoggerProviderBuilder AddConsoleExporter( /// Name which is used when retrieving options. /// Callback action for configuring . /// The supplied instance of to chain the calls. +#if NET8_0_OR_GREATER + [Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)] +#endif public #else /// diff --git a/src/OpenTelemetry.Exporter.Console/OpenTelemetry.Exporter.Console.csproj b/src/OpenTelemetry.Exporter.Console/OpenTelemetry.Exporter.Console.csproj index 2cea6f1094..46fec7d5e9 100644 --- a/src/OpenTelemetry.Exporter.Console/OpenTelemetry.Exporter.Console.csproj +++ b/src/OpenTelemetry.Exporter.Console/OpenTelemetry.Exporter.Console.csproj @@ -32,6 +32,7 @@ + diff --git a/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterLoggingExtensions.cs b/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterLoggingExtensions.cs index 855c96f957..982595f882 100644 --- a/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterLoggingExtensions.cs +++ b/src/OpenTelemetry.Exporter.InMemory/InMemoryExporterLoggingExtensions.cs @@ -1,6 +1,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#if EXPOSE_EXPERIMENTAL_FEATURES && NET8_0_OR_GREATER +using System.Diagnostics.CodeAnalysis; +#endif using OpenTelemetry.Exporter; using OpenTelemetry.Internal; @@ -36,6 +39,9 @@ public static OpenTelemetryLoggerOptions AddInMemoryExporter( /// . /// Collection which will be populated with the exported . /// The supplied instance of to chain the calls. +#if NET8_0_OR_GREATER + [Experimental(DiagnosticDefinitions.LoggerProviderExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)] +#endif public #else /// diff --git a/src/OpenTelemetry.Exporter.InMemory/OpenTelemetry.Exporter.InMemory.csproj b/src/OpenTelemetry.Exporter.InMemory/OpenTelemetry.Exporter.InMemory.csproj index ca347c71ba..7f7488e8c5 100644 --- a/src/OpenTelemetry.Exporter.InMemory/OpenTelemetry.Exporter.InMemory.csproj +++ b/src/OpenTelemetry.Exporter.InMemory/OpenTelemetry.Exporter.InMemory.csproj @@ -21,9 +21,10 @@ - + +