You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When setting ExportProcessorType.Simple on OtlpExporterOptions to select synchronous export, it doesn't work as expected. By default, it continues to select BatchLogRecordExportProcessor as the option. The setting only works when using ExportProcessorTypein LogRecordExportProcessorOptions.
This raises a question: What is the purpose of OtlpExporterOptions.ExportProcessorType if I need to set non-batch mode on LogRecordExportProcessorOptions? This behavior is confusing and inconsistent.
This code doesn't seem to work - still uses BatchLogRecordExportProcessor
usingMicrosoft.Extensions.DependencyInjection;usingMicrosoft.Extensions.Hosting;usingOpenTelemetry.Resources;usingOpenTelemetry.Exporter;usingMicrosoft.Extensions.Configuration;usingOpenTelemetry.Logs;usingMicrosoft.Extensions.Logging;usingOpenTelemetry;HostApplicationBuilderhostApplicationBuilder=Host.CreateApplicationBuilder(args);hostApplicationBuilder.Services.AddOpenTelemetry().ConfigureResource(resourceBuilder =>{resourceBuilder.AddService(serviceName:hostApplicationBuilder.Configuration.GetValue("ServiceName",defaultValue:"otel-test")!,serviceVersion:typeof(Program).Assembly.GetName().Version?.ToString()??"unknown",serviceInstanceId:Environment.MachineName);}).WithLogging(builder =>{builder.AddOtlpExporter(otlpOptions =>{// This setting doesn't seem to work - still uses BatchLogRecordExportProcessorotlpOptions.ExportProcessorType=ExportProcessorType.Simple;});});usingIHosthost=hostApplicationBuilder.Build();varlogger=host.Services.GetRequiredService<ILogger<Program>>();logger.LogInformation("OpenTelemetry logging is configured.");awaithost.RunAsync();
Expected vs Actual Behavior
Expected: Setting otlpOptions.ExportProcessorType = ExportProcessorType.Simpleshould configure the exporter to use simple (synchronous) export processing
Actual: The setting appears to be ignored, and BatchLogRecordExportProcessor is still used by default
Workaround
The workaround requires using the overload that provides access to LogRecordExportProcessorOptions:
.WithLogging(builder =>{builder.AddOtlpExporter((otlpOptions,logRecordExportProcessorOptions)=>{logRecordExportProcessorOptions.ExportProcessorType=ExportProcessorType.Simple;// Use IConfiguration directly for Otlp exporter endpoint option.//otlpOptions.Endpoint = new Uri(hostApplicationBuilder.Configuration.GetValue("Otlp:Endpoint", defaultValue: "http://localhost:4317"));// use default endpoint});});
Questions
Is OtlpExporterOptions.ExportProcessorType intended to be functional, or is it deprecated?
Should the export processor type always be configured via the LogRecordExportProcessorOptions parameter rather than the OtlpExporterOptions?
Is this inconsistent behavior a bug or by design?
Why do we have two different places to set the same ExportProcessorType property, and which one takes precedence?
The current API design is confusing because it suggests that OtlpExporterOptions.ExportProcessorType should control the processor type, but in practice, only the LogRecordExportProcessorOptions.ExportProcessorType setting appears to work.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Description
When setting
ExportProcessorType.Simple
onOtlpExporterOptions
to select synchronous export, it doesn't work as expected. By default, it continues to selectBatchLogRecordExportProcessor
as the option. The setting only works when usingExportProcessorType
inLogRecordExportProcessorOptions
.This raises a question: What is the purpose of
OtlpExporterOptions.ExportProcessorType
if I need to set non-batch mode onLogRecordExportProcessorOptions
? This behavior is confusing and inconsistent.This code doesn't seem to work - still uses BatchLogRecordExportProcessor
Expected vs Actual Behavior
Expected: Setting
otlpOptions.ExportProcessorType = ExportProcessorType.Simple
should configure the exporter to use simple (synchronous) export processingActual: The setting appears to be ignored, and
BatchLogRecordExportProcessor
is still used by defaultWorkaround
The workaround requires using the overload that provides access to
LogRecordExportProcessorOptions
:Questions
OtlpExporterOptions.ExportProcessorType
intended to be functional, or is it deprecated?LogRecordExportProcessorOptions
parameter rather than theOtlpExporterOptions
?ExportProcessorType
property, and which one takes precedence?The current API design is confusing because it suggests that
OtlpExporterOptions.ExportProcessorType
should control the processor type, but in practice, only theLogRecordExportProcessorOptions.ExportProcessorType
setting appears to work.Beta Was this translation helpful? Give feedback.
All reactions