Open ragheed-ism opened 1 week ago
When checking the agent code (telegraf/agent/agent.go) between versions 1.30 and 1.31, i found out the in the func (a *Agent) Run(ctx context.Context) error
part of the code, the intialization of plugins and states have been flipped.
Is this intentional? If yes, then shouldn't the docs be updated?
Relevant telegraf.conf
Logs from Telegraf
System info
Telergaf >=1.31.0, Ubuntu 20.04
Docker
No response
Steps to reproduce
Expected behavior
Init() should be called before SetState() when telegraf starts.
Actual behavior
Init() is being called after SetState() when telegraf starts.
Additional info
I am creating a custom aggregator that needs state persistence. When testing it, i found out that the SetState() is being called before Init(), which is the opposite of what the docs have stated. The easiest way to recreate the issue without adding my plugin is using the
inputs.tail
plugin. I ran the test for different version of telegraf and found out that the issue started with telegraf version 1.31.0 and is still present in the latest version (1.32.1 at the time of writing this issue).In order to make sure that this is not a visual bug, i add the following debugs at the start of Init() and SetState() for the tail plugin
and got the following results proving the issue