[logs] Reloading application configuration may lead to unnecessary thread creation #5513
Labels
bug
Something isn't working
logs
Logging signal related
pkg:OpenTelemetry
Issues related to OpenTelemetry NuGet package
Milestone
Overview
The delegate passed to
OpenTelemetryLoggingExtensions.AddOpenTelemetry
is registered as an options configuration (IConfigureOptions
) and will be replayed on a fresh instance ofOpenTelemetryLoggerOptions
anytime the applicationIConfiguration
is reloaded. If that delegate performsopenTelemetryLoggerOptions.AddProcessor(new BatchLogRecordExportProcessor(...))
a background thread is created which is never signaled to shutdown. In processes which reload configuration periodically this will lead to an ever-increasing number of threads being created. Note: The additional threads are never assigned logs to export/process they will just sit asleep and periodically wake up to check if there is work to do (which there never is).Reproduction \ example
Not impacted
Delegates using the factory form of
AddProcessor
which accepts thesp
parameter (options.AddProcessor(sp => BuildProcessor(sp))
are NOT impacted. The factory delegate is never invoked for configuration reloads. TheAddOtlpExporter
extension uses the factory form so it is NOT impacted.The experimental
LoggerProviderBuilder
andWithLogging
APIs are NOT impacted.The text was updated successfully, but these errors were encountered: