tihomir-kit / InfluxData.Net

InfluxData TICK stack .net library.
MIT License
156 stars 52 forks source link

gzip compression #80

Open HardWin13 opened 6 years ago

HardWin13 commented 6 years ago

Thanks lot for nice library! Does it support any compression mechanism? As I know, influxdb supports gzip compression for http line protocol and it would be useful if you'll add it to post request processing. https://community.influxdata.com/t/line-protocol-compression/4988 Suppose that it helps to reduce the amount of memory for big data storage.

Henna1977 commented 5 years ago

Yes, compression would be nice but is actual not supported. I use this client to upload big bundles of data and see real heavy network traffic.

airguru commented 4 years ago

I managed to get the gzip compression running! It turned out to be very easy as you can support a custom HttpClient to the InfluxDbClient.

Do this:

HttpClientHandler handler = new HttpClientHandler();
handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;

HttpClient httpClient = new HttpClient(handler);
httpClient.DefaultRequestHeaders.Add("Accept-Encoding", "gzip");

influxDbClient = new InfluxDbClient(url, user, password, InfluxDbVersion.v_1_3, httpClient: httpClient);