feat(outputs/wavefront): make maximum http batch size configurable (#11201)

This commit is contained in:
Luke Winikates 2022-06-29 12:27:56 -07:00 committed by GitHub
parent b638c5353f
commit 6e6fba77bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 21 deletions

View File

@ -15,6 +15,9 @@ Wavefront data format over TCP.
## Authentication Token for Wavefront. Only required if using Direct Ingestion ## Authentication Token for Wavefront. Only required if using Direct Ingestion
#token = "DUMMY_TOKEN" #token = "DUMMY_TOKEN"
## Maximum number of metrics to send per batch for Direct Ingestion. Ignored unless 'url' is set. This value should be higher than the `metric_batch_size`. Default is 10,000. Values higher than 40,000 are not recommended.
# http_maximum_batch_size = 10000
## DNS name of the wavefront proxy server. Do not use if url is specified ## DNS name of the wavefront proxy server. Do not use if url is specified
#host = "wavefront.example.com" #host = "wavefront.example.com"

View File

@ -7,6 +7,9 @@
## Authentication Token for Wavefront. Only required if using Direct Ingestion ## Authentication Token for Wavefront. Only required if using Direct Ingestion
#token = "DUMMY_TOKEN" #token = "DUMMY_TOKEN"
## Maximum number of metrics to send per batch for Direct Ingestion. Ignored unless 'url' is set. This value should be higher than the `metric_batch_size`. Default is 10,000. Values higher than 40,000 are not recommended.
# http_maximum_batch_size = 10000
## DNS name of the wavefront proxy server. Do not use if url is specified ## DNS name of the wavefront proxy server. Do not use if url is specified
#host = "wavefront.example.com" #host = "wavefront.example.com"

View File

@ -29,6 +29,7 @@ type Wavefront struct {
MetricSeparator string `toml:"metric_separator"` MetricSeparator string `toml:"metric_separator"`
ConvertPaths bool `toml:"convert_paths"` ConvertPaths bool `toml:"convert_paths"`
ConvertBool bool `toml:"convert_bool"` ConvertBool bool `toml:"convert_bool"`
HTTPMaximumBatchSize int `toml:"http_maximum_batch_size"`
UseRegex bool `toml:"use_regex"` UseRegex bool `toml:"use_regex"`
UseStrict bool `toml:"use_strict"` UseStrict bool `toml:"use_strict"`
TruncateTags bool `toml:"truncate_tags"` TruncateTags bool `toml:"truncate_tags"`
@ -87,6 +88,7 @@ func (w *Wavefront) Connect() error {
Server: w.URL, Server: w.URL,
Token: w.Token, Token: w.Token,
FlushIntervalSeconds: flushSeconds, FlushIntervalSeconds: flushSeconds,
BatchSize: w.HTTPMaximumBatchSize,
}) })
if err != nil { if err != nil {
return fmt.Errorf("could not create Wavefront Sender for Url: %s", w.URL) return fmt.Errorf("could not create Wavefront Sender for Url: %s", w.URL)
@ -298,6 +300,7 @@ func init() {
ConvertBool: true, ConvertBool: true,
TruncateTags: false, TruncateTags: false,
ImmediateFlush: true, ImmediateFlush: true,
HTTPMaximumBatchSize: 10000,
} }
}) })
} }

View File

@ -8,6 +8,7 @@ import (
"github.com/influxdata/telegraf" "github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/metric" "github.com/influxdata/telegraf/metric"
"github.com/influxdata/telegraf/plugins/outputs"
"github.com/influxdata/telegraf/testutil" "github.com/influxdata/telegraf/testutil"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -354,6 +355,11 @@ func TestTagLimits(t *testing.T) {
require.Equal(t, longKey, tags[longKey]) require.Equal(t, longKey, tags[longKey])
} }
func TestDefaults(t *testing.T) {
defaultWavefront := outputs.Outputs["wavefront"]().(*Wavefront)
require.Equal(t, 10000, defaultWavefront.HTTPMaximumBatchSize)
}
// Benchmarks to test performance of string replacement via Regex and Replacer // Benchmarks to test performance of string replacement via Regex and Replacer
var testString = "this_is*my!test/string\\for=replacement" var testString = "this_is*my!test/string\\for=replacement"