Parse Telegraf JSON Serializer Output back into Telegraf Metric

telegraf
#1

Hello, I am wondering if there are “official” ways of parsing JSON outputted by Telegraf JSON serializer into []Telegraf.Metric? If not, would it be a feature of interest? I dont mind filing a PR

Context:

  • I am working on using RabbitMQ as a middleman between Influx and Telegraf ([telegraf] -> [rabbitMQ] -> (custom consumer*) -> [influxDB]).

  • In order to use the batch option, Telegraf uses output.amqp with JSON output.

  • Custom consumer decodes Telegraf Serialized JSON []byte into Influx.Point and sends it to Influx

That said, the code is not coupled with the serializer logic, which is suboptimal

#2

Have you considered using data_format = "influx" for sending to rabbitmq? I haven’t timed them but I expect it will perform better than the JSON data format and will do lossless roundtripping.

#3

Thanks for the tip, using ParsePoints worked wonders.

1 Like