manigandham / serilog-sinks-googlecloudlogging

Serilog sink that writes events to Google Cloud Logging
MIT License
41 stars 25 forks source link

Allow specifying queue limit in GoogleCloudLoggingSink #39

Closed erdalsivri closed 4 years ago

erdalsivri commented 4 years ago

The base class of GoogleCloudLoggingSink, PeriodicBatchingSink, has an overload to specify queueLimit so it should be easy to add this.

However, PeriodicBatchingSink has a problem with the way default queue limit is specified so adding int queueLimit = NoQueueLimit (-1) to GoogleCloudLoggingSink constructor won't work. I've created another bug for this under serilog-sinks-periodicbatching: https://github.com/serilog/serilog-sinks-periodicbatching/issues/45

The reason I am asking to specify queue limit is that we've recently encountered some memory pressure in our application when we enabled Serilog -> GCP logging for some method that's called frequently from time to time. We would like to set a queue limit so logs are dropped instead of accumulated in memory.

erdalsivri commented 4 years ago

https://github.com/serilog/serilog-sinks-periodicbatching/issues/45 is fixed. You can specify NoQueueLimit or use the other constructor suggested by the maintainer here: https://github.com/serilog/serilog-sinks-periodicbatching/issues/45#issuecomment-636263960

manigandham commented 4 years ago

The fix hasn't been merged yet but I updated the sink to use the new interface. queueLimit has been added as a new int parameter.

https://www.nuget.org/packages/Serilog.Sinks.GoogleCloudLogging/3.1.0