For telegraf exec plugin, how does telegraf send data to influx?

Does it parse the entire output, and sends it as a batch insert? Or does it insert it as it’s getting the data?

For example,
will doing:

for i in measurements:
    print i

cost more vs doing this:

for i in measurements:
    record += measurements + '\n'
print record

Or is there no difference

Currently it doesn’t make a difference, each time Telegraf runs your program it buffers the entire stdout and parses it after the program exits.

However, I still recommend doing the former if possible. If we decide to optimize the exec plugin in the future it will continue to work in the best way possible and uses the least amount of memory in your program and is probably faster. Also, it is the easiest to write and debug.

1 Like