Add SerializeBatch method to the Serializer interface (#4107)
This commit is contained in:
@@ -25,6 +25,11 @@ type Serializer interface {
|
||||
// separate metrics should be separated by a newline, and there should be
|
||||
// a newline at the end of the buffer.
|
||||
Serialize(metric telegraf.Metric) ([]byte, error)
|
||||
|
||||
// SerializeBatch takes an array of telegraf metric and serializes it into
|
||||
// a byte buffer. This method is not required to be suitable for use with
|
||||
// line oriented framing.
|
||||
SerializeBatch(metrics []telegraf.Metric) ([]byte, error)
|
||||
}
|
||||
|
||||
// Config is a struct that covers the data types needed for all serializer types,
|
||||
@@ -72,7 +77,7 @@ func NewSerializer(config *Config) (Serializer, error) {
|
||||
}
|
||||
|
||||
func NewJsonSerializer(timestampUnits time.Duration) (Serializer, error) {
|
||||
return &json.JsonSerializer{TimestampUnits: timestampUnits}, nil
|
||||
return json.NewSerializer(timestampUnits)
|
||||
}
|
||||
|
||||
func NewInfluxSerializerConfig(config *Config) (Serializer, error) {
|
||||
|
||||
Reference in New Issue
Block a user