Skip to content

Commit

Permalink
feat(wavefront output): make http batch size configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeWinikates committed May 26, 2022
1 parent a4d2076 commit 3d05719
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugins/outputs/wavefront/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Wavefront data format over TCP.
## Authentication Token for Wavefront. Only required if using Direct Ingestion
#token = "DUMMY_TOKEN"

## Number of metrics to send per batch for Direct Ingestion. Ignored unless 'url' is set. Default is 10,000. Values higher than 40,000 are not recommended.
# http_batch_size = 10000

## DNS name of the wavefront proxy server. Do not use if url is specified
#host = "wavefront.example.com"

Expand Down
3 changes: 3 additions & 0 deletions plugins/outputs/wavefront/sample.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
## Authentication Token for Wavefront. Only required if using Direct Ingestion
#token = "DUMMY_TOKEN"

## Number of metrics to send per batch for Direct Ingestion. Ignored unless 'url' is set. Default is 10,000. Values higher than 40,000 are not recommended.
# http_batch_size = 10000

## DNS name of the wavefront proxy server. Do not use if url is specified
#host = "wavefront.example.com"

Expand Down
3 changes: 3 additions & 0 deletions plugins/outputs/wavefront/wavefront.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type Wavefront struct {
MetricSeparator string `toml:"metric_separator"`
ConvertPaths bool `toml:"convert_paths"`
ConvertBool bool `toml:"convert_bool"`
HTTPBatchSize int `toml:"http_batch_size"`
UseRegex bool `toml:"use_regex"`
UseStrict bool `toml:"use_strict"`
TruncateTags bool `toml:"truncate_tags"`
Expand Down Expand Up @@ -87,6 +88,7 @@ func (w *Wavefront) Connect() error {
Server: w.URL,
Token: w.Token,
FlushIntervalSeconds: flushSeconds,
BatchSize: w.,
})
if err != nil {
return fmt.Errorf("could not create Wavefront Sender for Url: %s", w.URL)
Expand Down Expand Up @@ -298,6 +300,7 @@ func init() {
ConvertBool: true,
TruncateTags: false,
ImmediateFlush: true,
: 10000,
}
})
}
Expand Down
6 changes: 6 additions & 0 deletions plugins/outputs/wavefront/wavefront_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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.HttpBatchSize)
}

// Benchmarks to test performance of string replacement via Regex and Replacer
var testString = "this_is*my!test/string\\for=replacement"

Expand Down

0 comments on commit 3d05719

Please sign in to comment.