Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add otlp log extension methods for LoggerProviderBuilder #4596

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4f26719
otlplog extension methods
vishweshbankwar Jun 15, 2023
a636ed9
add service registration
vishweshbankwar Jun 15, 2023
9f53a4f
Merge branch 'main' into vibankwa/add-loggerprovider-extensions-otlp
vishweshbankwar Jun 22, 2023
4e51f68
public API
vishweshbankwar Jun 22, 2023
c319624
fix test
vishweshbankwar Jun 22, 2023
d56c2fc
test
vishweshbankwar Jun 22, 2023
2ecc38c
IConfiguration fix.
CodeBlanch Jun 22, 2023
c0bb003
rmv using
vishweshbankwar Jun 22, 2023
c56d678
Tweak.
CodeBlanch Jun 22, 2023
5e01a89
Merge branch 'vibankwa/add-loggerprovider-extensions-otlp' of https:/…
CodeBlanch Jun 22, 2023
59d15ce
Fixed circular reference creating OpenTelemetryLoggerProvider.
CodeBlanch Jun 23, 2023
d2dbd30
Merge branch 'main' into vibankwa/add-loggerprovider-extensions-otlp
vishweshbankwar Jun 23, 2023
45e7783
additional test
vishweshbankwar Jun 23, 2023
058f941
Disable TryEnableIHttpClientFactoryIntegration in OtlpLogExporter.
CodeBlanch Jul 7, 2023
399b2f4
Merge branch 'main' into vibankwa/add-loggerprovider-extensions-otlp
vishweshbankwar Jul 7, 2023
53e89a9
Merge branch 'main' into vibankwa/add-loggerprovider-extensions-otlp
vishweshbankwar Jul 7, 2023
825878c
Merge branch 'main' into vibankwa/add-loggerprovider-extensions-otlp
vishweshbankwar Jul 17, 2023
f1f7de7
Merge branch 'main' into vibankwa/add-loggerprovider-extensions-otlp
vishweshbankwar Jul 17, 2023
3e20026
merge main
Yun-Ting Nov 17, 2023
aac88aa
Merge branch 'main' into vibankwa/add-loggerprovider-extensions-otlp
vishweshbankwar Nov 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@
// limitations under the License.
// </copyright>

using Microsoft.Extensions.Logging;

Check warning on line 17 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / check-format-experimental

Using directive is unnecessary.

Check warning on line 17 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / check-format-stable

Using directive is unnecessary.
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using OpenTelemetry.Exporter;
using OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation;
using OpenTelemetry.Internal;
using System.Diagnostics;

Check warning on line 23 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / check-format-experimental

Using directive is unnecessary.

Check warning on line 23 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / check-format-experimental

Using directive is unnecessary.

Check warning on line 23 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / check-format-experimental

Using directive is unnecessary.

Check warning on line 23 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / check-format-experimental

Using directive is unnecessary.

Check warning on line 23 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / check-format-stable

Using directive is unnecessary.

Check warning on line 23 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / check-format-stable

Using directive is unnecessary.

Check warning on line 23 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / check-format-stable

Using directive is unnecessary.

Check warning on line 23 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / check-format-stable

Using directive is unnecessary.

namespace OpenTelemetry.Logs;

Expand Down Expand Up @@ -45,14 +50,197 @@
=> AddOtlpExporterInternal(loggerOptions, configure);

/// <summary>
/// Adds an OTLP Exporter to the OpenTelemetry <see cref="ILoggerProvider"/>.
/// Adds OpenTelemetry Protocol (OTLP) exporter to the LoggerProvider.
/// </summary>
/// <param name="loggerOptions"><see cref="OpenTelemetryLoggerOptions"/> options to use.</param>
/// <param name="configureExporterAndProcessor">Callback action for configuring <see cref="OtlpExporterOptions"/> and <see cref="LogRecordExportProcessorOptions"/>.</param>
/// <returns>The instance of <see cref="OpenTelemetryLoggerOptions"/> to chain the calls.</returns>
public static OpenTelemetryLoggerOptions AddOtlpExporter(
this OpenTelemetryLoggerOptions loggerOptions,
/// <param name="builder"><see cref="LoggerProviderBuilder"/> builder to use.</param>
/// <returns>The instance of <see cref="LoggerProviderBuilder"/> to chain the calls.</returns>
public static LoggerProviderBuilder AddOtlpExporter(this LoggerProviderBuilder builder)

Check failure on line 57 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net8.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder)'

Check failure on line 57 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net8.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder)'

Check failure on line 57 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net7.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder)'

Check failure on line 57 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net7.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder)'

Check failure on line 57 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net6.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder)'

Check failure on line 57 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net6.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder)'

Check failure on line 57 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net8.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder)'

Check failure on line 57 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net8.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder)'

Check failure on line 57 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net7.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder)'

Check failure on line 57 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net7.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder)'

Check failure on line 57 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net462)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder)'

Check failure on line 57 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net462)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder)'

Check failure on line 57 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net6.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder)'

Check failure on line 57 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net6.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder)'

Check failure on line 57 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder)'

Check failure on line 57 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder)'

Check failure on line 57 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder)'

Check failure on line 57 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder)'
=> AddOtlpExporter(builder, name: null, configureExporter: null);

/// <summary>
/// Adds OpenTelemetry Protocol (OTLP) exporter to the LoggerProvider.
/// </summary>
/// <param name="builder"><see cref="LoggerProviderBuilder"/> builder to use.</param>
/// <param name="configureExporter">Callback action for configuring <see cref="OtlpExporterOptions"/>.</param>
/// <returns>The instance of <see cref="LoggerProviderBuilder"/> to chain the calls.</returns>
public static LoggerProviderBuilder AddOtlpExporter(this LoggerProviderBuilder builder, Action<OtlpExporterOptions> configureExporter)

Check failure on line 66 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net8.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions>)'

Check failure on line 66 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net8.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions>)'

Check failure on line 66 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net7.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions>)'

Check failure on line 66 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net7.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions>)'

Check failure on line 66 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net6.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions>)'

Check failure on line 66 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net6.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions>)'

Check failure on line 66 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net8.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions>)'

Check failure on line 66 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net8.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions>)'

Check failure on line 66 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net7.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions>)'

Check failure on line 66 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net7.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions>)'

Check failure on line 66 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net462)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions>)'

Check failure on line 66 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net462)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions>)'

Check failure on line 66 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net6.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions>)'

Check failure on line 66 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net6.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions>)'

Check failure on line 66 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions>)'

Check failure on line 66 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions>)'

Check failure on line 66 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions>)'

Check failure on line 66 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions>)'
=> AddOtlpExporter(builder, name: null, configureExporter: configureExporter);

/// <summary>
/// Adds OpenTelemetry Protocol (OTLP) exporter to the LoggerProvider.
/// </summary>
/// <param name="builder"><see cref="LoggerProviderBuilder"/> builder to use.</param>
/// <param name="configureExporterAndProcessor">Callback action for
/// configuring <see cref="OtlpExporterOptions"/> and <see
/// cref="LogRecordExportProcessorOptions"/>.</param>
/// <returns>The instance of <see cref="LoggerProviderBuilder"/> to chain the calls.</returns>
public static LoggerProviderBuilder AddOtlpExporter(this LoggerProviderBuilder builder, Action<OtlpExporterOptions, LogRecordExportProcessorOptions> configureExporterAndProcessor)

Check failure on line 77 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net8.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 77 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net8.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 77 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net7.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 77 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net7.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 77 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net6.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 77 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net6.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 77 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net8.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 77 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net8.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 77 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net7.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 77 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net7.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 77 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net462)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 77 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net462)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 77 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net6.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 77 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net6.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 77 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 77 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'
=> AddOtlpExporter(builder, name: null, configureExporterAndProcessor: configureExporterAndProcessor);

/// <summary>
/// Adds OpenTelemetry Protocol (OTLP) exporter to the LoggerProvider.
/// </summary>
/// <param name="builder"><see cref="LoggerProviderBuilder"/> builder to use.</param>
/// <param name="name">Name which is used when retrieving options.</param>
/// <param name="configureExporter">Callback action for configuring <see cref="OtlpExporterOptions"/>.</param>
/// <returns>The instance of <see cref="LoggerProviderBuilder"/> to chain the calls.</returns>
public static LoggerProviderBuilder AddOtlpExporter(

Check failure on line 87 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net8.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions>)'

Check failure on line 87 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net8.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions>)'

Check failure on line 87 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net7.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions>)'

Check failure on line 87 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net7.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions>)'

Check failure on line 87 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net6.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions>)'

Check failure on line 87 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net6.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions>)'

Check failure on line 87 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net8.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions>)'

Check failure on line 87 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net8.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions>)'

Check failure on line 87 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net7.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions>)'

Check failure on line 87 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net7.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions>)'

Check failure on line 87 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net462)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions>)'

Check failure on line 87 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net462)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions>)'

Check failure on line 87 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net6.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions>)'

Check failure on line 87 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net6.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions>)'
this LoggerProviderBuilder builder,
string name,
Action<OtlpExporterOptions> configureExporter)
{
var finalOptionsName = name ?? Options.DefaultName;

builder.ConfigureServices(services =>
{
if (name != null && configureExporter != null)
{
// If we are using named options we register the
// configuration delegate into options pipeline.
services.Configure(finalOptionsName, configureExporter);
}

OtlpExporterOptions.RegisterOtlpExporterOptionsFactory(services);
services.RegisterOptionsFactory(configuration => new SdkLimitOptions(configuration));
});

return builder.AddProcessor(sp =>
{
OtlpExporterOptions exporterOptions;

if (name == null)
{
// If we are NOT using named options we create a new
// instance always. The reason for this is
// OtlpExporterOptions is shared by all signals. Without a
// name, delegates for all signals will mix together. See:
// https://github.com/open-telemetry/opentelemetry-dotnet/issues/4043
exporterOptions = sp.GetRequiredService<IOptionsFactory<OtlpExporterOptions>>().Create(finalOptionsName);

// Configuration delegate is executed inline on the fresh instance.
configureExporter?.Invoke(exporterOptions);
}
else
{
// When using named options we can properly utilize Options
// API to create or reuse an instance.
exporterOptions = sp.GetRequiredService<IOptionsMonitor<OtlpExporterOptions>>().Get(finalOptionsName);
}

// Note: Not using finalOptionsName here for SdkLimitOptions.
// There should only be one provider for a given service
// collection so SdkLimitOptions is treated as a single default
// instance.
var sdkOptionsManager = sp.GetRequiredService<IOptionsMonitor<SdkLimitOptions>>().CurrentValue;

return BuildOtlpLogExporterProcessor(
exporterOptions,
sp.GetRequiredService<IOptionsMonitor<LogRecordExportProcessorOptions>>().Get(finalOptionsName),
sdkOptionsManager,
sp);
});
}

/// <summary>
/// Adds OpenTelemetry Protocol (OTLP) exporter to the LoggerProvider.
/// </summary>
/// <param name="builder"><see cref="LoggerProviderBuilder"/> builder to use.</param>
/// <param name="name">Name which is used when retrieving options.</param>
/// <param name="configureExporterAndProcessor">Callback action for
/// configuring <see cref="OtlpExporterOptions"/> and <see
/// cref="LogRecordExportProcessorOptions"/>.</param>
/// <returns>The instance of <see cref="LoggerProviderBuilder"/> to chain the calls.</returns>
public static LoggerProviderBuilder AddOtlpExporter(

Check failure on line 153 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net8.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 153 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net8.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 153 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net7.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 153 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net7.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 153 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net6.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 153 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (ubuntu-latest, net6.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 153 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net8.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 153 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net8.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 153 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net7.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 153 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net7.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 153 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net462)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 153 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net462)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 153 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net6.0)

Inconsistent accessibility: return type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'

Check failure on line 153 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-stable (windows-latest, net6.0)

Inconsistent accessibility: parameter type 'LoggerProviderBuilder' is less accessible than method 'OtlpLogExporterHelperExtensions.AddOtlpExporter(LoggerProviderBuilder, string, Action<OtlpExporterOptions, LogRecordExportProcessorOptions>)'
this LoggerProviderBuilder builder,
string name,
Action<OtlpExporterOptions, LogRecordExportProcessorOptions> configureExporterAndProcessor)
{
var finalOptionsName = name ?? Options.DefaultName;

builder.ConfigureServices(services =>
{
OtlpExporterOptions.RegisterOtlpExporterOptionsFactory(services);
services.RegisterOptionsFactory(configuration => new SdkLimitOptions(configuration));
});

return builder.AddProcessor(sp =>
{
OtlpExporterOptions exporterOptions;
LogRecordExportProcessorOptions processorOptions;

if (name == null)
{
// If we are NOT using named options we create a new
// instance always. The reason for this is
// OtlpExporterOptions is shared by all signals. Without a
// name, delegates for all signals will mix together. See:
// https://github.com/open-telemetry/opentelemetry-dotnet/issues/4043
exporterOptions = sp.GetRequiredService<IOptionsFactory<OtlpExporterOptions>>().Create(finalOptionsName);
processorOptions = sp.GetRequiredService<IOptionsFactory<LogRecordExportProcessorOptions>>().Create(finalOptionsName);

// Configuration delegate is executed inline on the fresh instance.
configureExporterAndProcessor?.Invoke(exporterOptions, processorOptions);
}
else
{
// When using named options we can properly utilize Options
// API to create or reuse an instance.
exporterOptions = sp.GetRequiredService<IOptionsMonitor<OtlpExporterOptions>>().Get(finalOptionsName);
processorOptions = sp.GetRequiredService<IOptionsMonitor<LogRecordExportProcessorOptions>>().Get(finalOptionsName);
}

// Note: Not using finalOptionsName here for SdkLimitOptions.
// There should only be one provider for a given service
// collection so SdkLimitOptions is treated as a single default
// instance.
var sdkOptionsManager = sp.GetRequiredService<IOptionsMonitor<SdkLimitOptions>>().CurrentValue;

return BuildOtlpLogExporterProcessor(
exporterOptions,
processorOptions,
sdkOptionsManager,
sp);
});
}

private static BaseProcessor<LogRecord> BuildOtlpLogExporterProcessor(OtlpExporterOptions exporterOptions, LogRecordExportProcessorOptions processorOptions, SdkLimitOptions sdkLimitOptions, IServiceProvider sp)
{
/*
* Note:
*
* We don't currently enable IHttpClientFactory for OtlpLogExporter.
*
* The DefaultHttpClientFactory requires the ILoggerFactory in its ctor:
* https://github.com/dotnet/runtime/blob/fa40ecf7d36bf4e31d7ae968807c1c529bac66d6/src/libraries/Microsoft.Extensions.Http/src/DefaultHttpClientFactory.cs#L64
*
* This creates a circular reference: ILoggerFactory ->
* OpenTelemetryLoggerProvider -> OtlpLogExporter -> IHttpClientFactory
* -> ILoggerFactory
*
* exporterOptions.TryEnableIHttpClientFactoryIntegration(sp,
* "OtlpLogExporter");
*/

BaseExporter<LogRecord> otlpExporter = new OtlpLogExporter(exporterOptions, sdkLimitOptions);

if (processorOptions.ExportProcessorType == ExportProcessorType.Simple)
{
return new SimpleLogRecordExportProcessor(otlpExporter);
}
else
{
return new BatchLogRecordExportProcessor(
otlpExporter,
processorOptions.BatchExportProcessorOptions.MaxQueueSize,
processorOptions.BatchExportProcessorOptions.ScheduledDelayMilliseconds,
processorOptions.BatchExportProcessorOptions.ExporterTimeoutMilliseconds,
processorOptions.BatchExportProcessorOptions.MaxExportBatchSize);
}
}

private static OpenTelemetryLoggerOptions AddOtlpExporterInternal(
OpenTelemetryLoggerOptions loggerOptions,
Action<OtlpExporterOptions> configure)
{
var exporterOptions = new OtlpExporterOptions();
var processorOptions = new LogRecordExportProcessorOptions();
Expand Down Expand Up @@ -91,7 +279,7 @@
}
}

private static OpenTelemetryLoggerOptions AddOtlpExporterInternal(

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net7.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net7.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net7.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net7.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net7.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net7.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net7.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net7.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net7.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net7.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net8.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net8.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net8.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net8.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net8.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net8.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net8.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net8.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net8.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net8.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net6.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net6.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net6.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net6.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net6.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net6.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net6.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net6.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net6.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (ubuntu-latest, net6.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net7.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net7.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net7.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net7.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net7.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net7.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net7.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net7.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net7.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net7.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-report (windows-latest)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-report (windows-latest)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-report (windows-latest)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-report (windows-latest)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-report (windows-latest)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-report (windows-latest)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-report (windows-latest)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-report (windows-latest)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-report (windows-latest)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-report (windows-latest)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net6.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net6.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net6.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net6.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net6.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net6.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net6.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net6.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net6.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net6.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net8.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net8.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net8.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net8.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net8.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net8.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net8.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net8.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net8.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net8.0)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net462)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net462)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net462)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net462)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net462)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net462)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net462)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net462)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net462)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types

Check failure on line 282 in src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpLogExporterHelperExtensions.cs

View workflow job for this annotation

GitHub Actions / build-test-experimental (windows-latest, net462)

Type 'OtlpLogExporterHelperExtensions' already defines a member called 'AddOtlpExporterInternal' with the same parameter types
OpenTelemetryLoggerOptions loggerOptions,
Action<OtlpExporterOptions> configure)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ OpenTelemetryBuilder WithLogging(Action<LoggerProviderBuilder> configure)
{
Guard.ThrowIfNull(configure);

var builder = new LoggerProviderBuilderBase(this.Services);
var builder = new LoggerProviderBuilderBase(this.Services, addSharedServices: false);

configure(builder);

Expand Down
13 changes: 12 additions & 1 deletion src/OpenTelemetry/Logs/Builder/LoggerProviderBuilderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,21 @@ public LoggerProviderBuilderBase()
this.allowBuild = true;
}

internal LoggerProviderBuilderBase(IServiceCollection services)
internal LoggerProviderBuilderBase(IServiceCollection services, bool addSharedServices)
{
Guard.ThrowIfNull(services);

if (addSharedServices)
{
/* Note: This ensures IConfiguration is available when using
* IServiceCollections NOT attached to a host. For example when
* performing:
*
* new ServiceCollection().AddLogging(b => b.AddOpenTelemetry())
*/
services.AddOpenTelemetrySharedProviderBuilderServices();
}

services
.AddOpenTelemetryLoggerProviderBuilderServices()
.TryAddSingleton<LoggerProvider>(sp => new LoggerProviderSdk(sp, ownsServiceProvider: false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
// limitations under the License.
// </copyright>

#nullable enable

using System.Diagnostics;
#if NET6_0_OR_GREATER
using System.Diagnostics.CodeAnalysis;
#endif
Expand Down Expand Up @@ -58,7 +61,7 @@ public static ILoggingBuilder AddOpenTelemetry(
// Note: This will bind logger options element (eg "Logging:OpenTelemetry") to OpenTelemetryLoggerOptions
RegisterLoggerProviderOptions(builder.Services);

new LoggerProviderBuilderBase(builder.Services).ConfigureBuilder(
new LoggerProviderBuilderBase(builder.Services, addSharedServices: true).ConfigureBuilder(
(sp, logging) =>
{
var options = sp.GetRequiredService<IOptionsMonitor<OpenTelemetryLoggerOptions>>().CurrentValue;
Expand All @@ -80,10 +83,40 @@ public static ILoggingBuilder AddOpenTelemetry(

builder.Services.TryAddEnumerable(
ServiceDescriptor.Singleton<ILoggerProvider, OpenTelemetryLoggerProvider>(
sp => new OpenTelemetryLoggerProvider(
sp.GetRequiredService<LoggerProvider>(),
sp.GetRequiredService<IOptionsMonitor<OpenTelemetryLoggerOptions>>().CurrentValue,
disposeProvider: false)));
sp =>
{
var state = sp.GetRequiredService<LoggerProviderBuilderSdk>();

var provider = state.Provider;
if (provider == null)
{
/*
* Note:
*
* There is the possibility of a circular reference when
* accessing LoggerProvider from the IServiceProvider.
*
* If LoggerProvider is the first thing accessed and it
* requires some service which accesses ILogger (for
* example IHttpClientFactory) than the
* OpenTelemetryLoggerProvider will try to access the
* LoggerProvider inside the initial access to
* LoggerProvider.
*
* This check uses the provider reference captured on
* LoggerProviderBuilderSdk during construction of
* LoggerProviderSdk to detect if a provider has already
* been created to give to OpenTelemetryLoggerProvider.
*/
provider = sp.GetRequiredService<LoggerProvider>();
Debug.Assert(provider == state.Provider, "state.Provider did not match resolved LoggerProvider");
}

return new OpenTelemetryLoggerProvider(
provider,
sp.GetRequiredService<IOptionsMonitor<OpenTelemetryLoggerOptions>>().CurrentValue,
disposeProvider: false);
}));

return builder;

Expand Down
Loading
Loading