influxdb-csharp
influxdb-csharp copied to clipboard
Correct method to flush measurements for short lived applications
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.
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.