telegraf icon indicating copy to clipboard operation
telegraf copied to clipboard

[inputs.internal] buffer_limit and buffer_size are wrong when multiple outputs of the same type are configured

Open Zanthras opened this issue 5 years ago • 4 comments

Relevent telegraf.conf

[agent]
  interval = "2s"

[[outputs.influxdb]]
  metric_buffer_limit = 10
  urls = ["http://localhost:9999"]
  [outputs.influxdb.tagpass]
    output = [ "file" ]

[[outputs.influxdb]]
  metric_buffer_limit = 100
  urls = ["http://localhost:9998"]

[[inputs.internal]]

[[outputs.file]]
  files = ["stdout"]
  data_format = "json"

System info

Telegraf 1.20.0

Docker

No response

Steps to reproduce

1.) Run the config as described (with no influx server at the listed ports) 2.) Wait for the buffers to fill up 3.) look at the buffer_limit/buffer_size metrics

Expected behavior

The internal_write measurement buffer_limit and buffer_size fields should reflect the two distinct output configurations in a sane manner.

Presumable an additional tag could be added for internal_write which would be "plugin_order" to allow for differentiation of outputs with the same type. And then track the other various added/droped/filtered/written per output plugin, not just per plugin type.

Presumably the plugin order would remain the same between restarts assuming the configuration was unchanged.

Actual behavior

buffer_limit is always the last output configured, buffer_size randomly flips between any of the output buffer sizes. The mix of consistent (but incomplete) buffer_limit and random buffer_size makes using that information basically impossible when multiple output plugins of the same type are in use.

Additional info

No response

Zanthras avatar Nov 01 '21 22:11 Zanthras

@Zanthras, can you try adding different alias values to each of the outputs? https://github.com/influxdata/telegraf/blob/master/docs/CONFIGURATION.md Something like: `[[outputs.influxdb]] metric_buffer_limit = 10 urls = ["http://localhost:9999"] alias = "localhost:9999" [outputs.influxdb.tagpass] output = [ "file" ]

[[outputs.influxdb]] metric_buffer_limit = 100 urls = ["http://localhost:9998"] alias = "localhost:9998"

[[outputs.file]] files = ["stdout"] data_format = "json" alias = "json_file"`

tesibelda avatar Nov 02 '21 18:11 tesibelda

Alias does properly add a tag and divide up the metrics. I guess any differing static tag would do the same, its just a shame the default status for those metrics is wrong then.

{"fields":{"buffer_limit":10,"buffer_size":10,"errors":26,"metrics_added":13,"metrics_dropped":3,"metrics_filtered":65,"metrics_written":0,"write_time_ns":648500},"name":"internal_write","tags":{"alias":"influx1","host":"Technetium","output":"influxdb","version":"1.20.0"},"timestamp":1635889464} {"fields":{"buffer_limit":100,"buffer_size":78,"errors":26,"metrics_added":78,"metrics_dropped":0,"metrics_filtered":0,"metrics_written":0,"write_time_ns":557400},"name":"internal_write","tags":{"alias":"inlfux2","host":"Technetium","output":"influxdb","version":"1.20.0"},"timestamp":1635889464}

Zanthras avatar Nov 02 '21 22:11 Zanthras

@Zanthras Is this still a bug for you?

sjwang90 avatar Mar 31 '22 18:03 sjwang90

Hello! I am closing this issue due to inactivity. I hope you were able to resolve your problem, if not please try posting this question in our Community Slack or Community Page. Thank you!

telegraf-tiger[bot] avatar Apr 15 '22 18:04 telegraf-tiger[bot]