Open Wimmelwaldi opened 1 month ago
Hi,
I haven't responded to the forums as I need to dig in and understand the implications of making this change to existing users. In general, no one has ever mentioned tracking metrics with the shim before, so it is unlikely it would impact anyone, but we need to ensure that how we acknowledge the metrics and when is done correctly.
Let me talk to folks on Monday and get back to you.
Hi,
My apologies for the delay, I got sick last week and then we had some holiday time.
After chatting with the team, I think we agree that it makes sense to make a change to Telegraf to call m.Accept
on the metric. This way the metrics are always considered accepted, internal tracking metrics will show a correct count, rather than a large number of dropped metrics, and it ensures that the max_undelivered_messages
will correctly decrement as well.
An additional clear statement to the readme would be needed to ensure that users understand that the plugin calls accepted no matter what.
Are you willing to put up a PR to make this change?
Thanks!
Relevant telegraf.conf
Logs from Telegraf
System info
Telegraf 1.31, Windows 10
Docker
No response
Steps to reproduce
Probably the easiest way to reproduce this:
Expected behavior
Receive feedback when a metric has been successfully written to stdout so that the plugin does not get stuck.
Actual behavior
The maximum amount of processed messages will be equal to
max_undelivered_messages
because the metrics are never getting acknowledged.Additional info
I had already created a post about this in the community forum: https://community.influxdata.com/t/metric-tracking-with-external-plugin/34710
I think it is a serious bug that the methods for metric tracking in an external plugin do not work at all, because the accumulator is provided by shim and is processed by it as well. The metrics were simply neglected to be acknowledged under certain circumstances.
Hence my suggestion, to use the two methods
m.Drop()
andm.Reject()
after the call in this line https://github.com/influxdata/telegraf/blob/v1.31.0/plugins/common/shim/goshim.go#L121Yes, the functionality of metric tracking when used in an external plugin would then differ somewhat from the usual application, but it would still provide useful functionality under these circumstances.