feat(outputs/wavefront): make maximum http batch size configurable (#11201)
This commit is contained in:
parent
b638c5353f
commit
6e6fba77bb
|
|
@ -15,6 +15,9 @@ Wavefront data format over TCP.
|
|||
## Authentication Token for Wavefront. Only required if using Direct Ingestion
|
||||
#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
|
||||
#host = "wavefront.example.com"
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@
|
|||
## Authentication Token for Wavefront. Only required if using Direct Ingestion
|
||||
#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
|
||||
#host = "wavefront.example.com"
|
||||
|
||||
|
|
|
|||
|
|
@ -20,21 +20,22 @@ var sampleConfig string
|
|||
const maxTagLength = 254
|
||||
|
||||
type Wavefront struct {
|
||||
URL string `toml:"url"`
|
||||
Token string `toml:"token"`
|
||||
Host string `toml:"host"`
|
||||
Port int `toml:"port"`
|
||||
Prefix string `toml:"prefix"`
|
||||
SimpleFields bool `toml:"simple_fields"`
|
||||
MetricSeparator string `toml:"metric_separator"`
|
||||
ConvertPaths bool `toml:"convert_paths"`
|
||||
ConvertBool bool `toml:"convert_bool"`
|
||||
UseRegex bool `toml:"use_regex"`
|
||||
UseStrict bool `toml:"use_strict"`
|
||||
TruncateTags bool `toml:"truncate_tags"`
|
||||
ImmediateFlush bool `toml:"immediate_flush"`
|
||||
SourceOverride []string `toml:"source_override"`
|
||||
StringToNumber map[string][]map[string]float64 `toml:"string_to_number" deprecated:"1.9.0;use the enum processor instead"`
|
||||
URL string `toml:"url"`
|
||||
Token string `toml:"token"`
|
||||
Host string `toml:"host"`
|
||||
Port int `toml:"port"`
|
||||
Prefix string `toml:"prefix"`
|
||||
SimpleFields bool `toml:"simple_fields"`
|
||||
MetricSeparator string `toml:"metric_separator"`
|
||||
ConvertPaths bool `toml:"convert_paths"`
|
||||
ConvertBool bool `toml:"convert_bool"`
|
||||
HTTPMaximumBatchSize int `toml:"http_maximum_batch_size"`
|
||||
UseRegex bool `toml:"use_regex"`
|
||||
UseStrict bool `toml:"use_strict"`
|
||||
TruncateTags bool `toml:"truncate_tags"`
|
||||
ImmediateFlush bool `toml:"immediate_flush"`
|
||||
SourceOverride []string `toml:"source_override"`
|
||||
StringToNumber map[string][]map[string]float64 `toml:"string_to_number" deprecated:"1.9.0;use the enum processor instead"`
|
||||
|
||||
sender wavefront.Sender
|
||||
Log telegraf.Logger `toml:"-"`
|
||||
|
|
@ -87,6 +88,7 @@ func (w *Wavefront) Connect() error {
|
|||
Server: w.URL,
|
||||
Token: w.Token,
|
||||
FlushIntervalSeconds: flushSeconds,
|
||||
BatchSize: w.HTTPMaximumBatchSize,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not create Wavefront Sender for Url: %s", w.URL)
|
||||
|
|
@ -292,12 +294,13 @@ func (w *Wavefront) Close() error {
|
|||
func init() {
|
||||
outputs.Add("wavefront", func() telegraf.Output {
|
||||
return &Wavefront{
|
||||
Token: "DUMMY_TOKEN",
|
||||
MetricSeparator: ".",
|
||||
ConvertPaths: true,
|
||||
ConvertBool: true,
|
||||
TruncateTags: false,
|
||||
ImmediateFlush: true,
|
||||
Token: "DUMMY_TOKEN",
|
||||
MetricSeparator: ".",
|
||||
ConvertPaths: true,
|
||||
ConvertBool: true,
|
||||
TruncateTags: false,
|
||||
ImmediateFlush: true,
|
||||
HTTPMaximumBatchSize: 10000,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import (
|
|||
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/metric"
|
||||
"github.com/influxdata/telegraf/plugins/outputs"
|
||||
"github.com/influxdata/telegraf/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
|
@ -354,6 +355,11 @@ func TestTagLimits(t *testing.T) {
|
|||
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
|
||||
var testString = "this_is*my!test/string\\for=replacement"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue