serilog-sinks-azure-analytics icon indicating copy to clipboard operation
serilog-sinks-azure-analytics copied to clipboard

Migrate to Serilog PeriodicBatching and increase throughput

Open kendallmiller opened this issue 1 year ago • 0 comments

We were running into a performance issue and when researching determined that the Serilog.Sinks.PeriodicBatching provider was a better fit for Azure Log Analytics. The overwhelming changes were to normalize the configuration with Serilog's PeriodBatching configuration.

Of note:

  • EmitBatchAsync replaces WriteLogEventAsync. EmitBatchAsync is provided by and called by Serilog.
  • Changes to PostDataAsync remove the need for the semaphore - it no longer modifies default properties of the client and the list it is passed is not modified by EmitBatchAsync.
  • Calls to PostDataAsync are independently asynchronous and can overlap for the same batch (so sending large batches is much faster).

kendallmiller avatar Feb 18 '24 16:02 kendallmiller