Skip to content

Commit

Permalink
Use batch serialization format in exec output (influxdata#6446)
Browse files Browse the repository at this point in the history
  • Loading branch information
morfien101 authored and Mathieu Lecarme committed Apr 17, 2020
1 parent bd958bf commit 5296691
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions plugins/outputs/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@ func (e *Exec) SampleConfig() string {
// Write writes the metrics to the configured command.
func (e *Exec) Write(metrics []telegraf.Metric) error {
var buffer bytes.Buffer
for _, metric := range metrics {
value, err := e.serializer.Serialize(metric)
if err != nil {
return err
}
buffer.Write(value)
serializedMetrics, err := e.serializer.SerializeBatch(metrics)
if err != nil {
return err
}
buffer.Write(serializedMetrics)

if buffer.Len() <= 0 {
return nil
Expand Down

0 comments on commit 5296691

Please sign in to comment.