Use batch serialization format in exec output (#6446)
This commit is contained in:
parent
aef93fd1c6
commit
62c6e30a78
|
@ -67,13 +67,11 @@ func (e *Exec) SampleConfig() string {
|
||||||
// Write writes the metrics to the configured command.
|
// Write writes the metrics to the configured command.
|
||||||
func (e *Exec) Write(metrics []telegraf.Metric) error {
|
func (e *Exec) Write(metrics []telegraf.Metric) error {
|
||||||
var buffer bytes.Buffer
|
var buffer bytes.Buffer
|
||||||
for _, metric := range metrics {
|
serializedMetrics, err := e.serializer.SerializeBatch(metrics)
|
||||||
value, err := e.serializer.Serialize(metric)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
buffer.Write(value)
|
buffer.Write(serializedMetrics)
|
||||||
}
|
|
||||||
|
|
||||||
if buffer.Len() <= 0 {
|
if buffer.Len() <= 0 {
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue