From 8837400bf270ff4b52e8400cfc7db4e3910a9734 Mon Sep 17 00:00:00 2001 From: Holger Obermaier <40787752+ho-ob@users.noreply.github.com> Date: Mon, 9 Oct 2023 16:57:26 +0200 Subject: [PATCH] Add config option to specify whether to use GZip compression in influx write requests --- sinks/influxSink.go | 5 +++++ sinks/influxSink.md | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sinks/influxSink.go b/sinks/influxSink.go index ac7382a..5bdf5c6 100644 --- a/sinks/influxSink.go +++ b/sinks/influxSink.go @@ -53,6 +53,8 @@ type InfluxSink struct { InfluxMaxRetries uint `json:"max_retries,omitempty"` // maximum total retry timeout InfluxMaxRetryTime string `json:"max_retry_time,omitempty"` + // Specify whether to use GZip compression in write requests + InfluxUseGzip bool `json:"use_gzip"` } batch []string flushTimer *time.Timer @@ -129,6 +131,9 @@ func (s *InfluxSink) connect() error { } } + // Specify whether to use GZip compression in write requests + clientOptions.SetUseGZip(s.config.InfluxUseGzip) + // Do not check InfluxDB certificate clientOptions.SetTLSConfig( &tls.Config{ diff --git a/sinks/influxSink.md b/sinks/influxSink.md index 7bd5d18..258ecb5 100644 --- a/sinks/influxSink.md +++ b/sinks/influxSink.md @@ -17,7 +17,8 @@ The `influxdb` sink uses the official [InfluxDB golang client](https://pkg.go.de "organization": "myorg", "ssl": true, "flush_delay" : "1s", - "batch_size" : 1000 + "batch_size" : 1000, + "use_gzip": true } } ``` @@ -40,3 +41,4 @@ Influx client options: - `retry_exponential_base`: base for the exponential retry delay - `max_retries`: maximum count of retry attempts of failed writes - `max_retry_time`: maximum total retry timeout +- `use_gzip`: Specify whether to use GZip compression in write requests