Serializer is an interface defining functions that a serializer plugin must satisfy. Implementations of this interface should be reentrant but are not required to be thread-safe.
| 6 | // Implementations of this interface should be reentrant but are not required |
| 7 | // to be thread-safe. |
| 8 | type Serializer interface { |
| 9 | // Serialize takes a single telegraf metric and turns it into a byte buffer. |
| 10 | // separate metrics should be separated by a newline, and there should be |
| 11 | // a newline at the end of the buffer. |
| 12 | // |
| 13 | // New plugins should use SerializeBatch instead to allow for non-line |
| 14 | // delimited metrics. |
| 15 | Serialize(metric Metric) ([]byte, error) |
| 16 | |
| 17 | // SerializeBatch takes an array of telegraf metric and serializes it into |
| 18 | // a byte buffer. This method is not required to be suitable for use with |
| 19 | // line oriented framing. |
| 20 | SerializeBatch(metrics []Metric) ([]byte, error) |
| 21 | } |
| 22 | |
| 23 | // SerializerFunc is a function to create a new instance of a serializer |
| 24 | type SerializerFunc func() (Serializer, error) |
no outgoing calls
no test coverage detected
searching dependent graphs…