influxdb-csharp icon indicating copy to clipboard operation
influxdb-csharp copied to clipboard

Correct method to flush measurements for short lived applications

Open andrewdedesko opened this issue 6 years ago • 1 comments

Hi,

I ran into an issue with the MetricsCollector and a short lived application. By default we use a batch interval of 5 seconds. My application runs for less than that, so I was noticing that measurements were lost.

I addressed this by calling Influx.Metrics.Close(); at the end of the application to flush measurements.

What's the correct way of handling this kind of scenario? I'd like to take advantage of batches but it might be nice to be able to explicitly flush measurements without closing the db connection. It appears there is not Flush() facility.

andrewdedesko avatar Dec 18 '18 18:12 andrewdedesko

There's no DB connection, it's HTTP or UDP. The Close() method just calls Dispose() on the static Collector which submits the pending data. That's the right way to do it.

manigandham avatar Jan 11 '19 20:01 manigandham