Need a PluginErrorHandler interface or something that telegraf can callback when it fails to poll for metrics.
#10,245 opened on Dec 8, 2021
Repository metrics
- Stars
- (9,892 stars)
- PR merge metrics
- (Avg merge 2d 12h) (136 merged PRs in 30d)
Description
Feature Request
Need a PluginErrorHandler interface or something that telegraf can callback when it fails to poll for metrics. For more context please check out this thread: https://influxcommunity.slack.com/archives/CH7C56X4Z/p1638920766176700
Proposal:
A new interface something like this: So an interface something like this:
type PluginErrorHandler interface {
OnError(err error)
}
would be really useful. https://influxcommunity.slack.com/archives/CH7C56X4Z/p1638984531179900?thread_ts=1638920766.176700&cid=CH7C56X4Z
Current behavior:
On this line: https://github.com/influxdata/telegraf/blob/34ad5aa137f0d845d79826839379cb543c3879c5/agent/agent.go#L451 I see the error being added to the accumulator and the accumulator just logs the error.
Desired behavior:
The accumulator should also call the OnError method of the PluginErrorHandler interface in addition to logging the error.
Use case:
We rely on telegraf heavily to poll MSSQL perf metrics and in case of any errors with polling we would like to capture errors and send it to downstream services for processing. An example would be MS SQL Server browser not running. If such error is reported, we want our system to attempt enabling the sql server browser. For complex errors we could surface these errors in our health check portal.