influxdata / influxdata/telegraf
Need a PluginErrorHandler interface or something that telegraf can callback when it fails to poll for metrics.
- Dominant language
- Go
- Stars
- 17.8k
- Forks
- 5.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 161
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.
Contributor guide
Research direction
Start at agent/agent.go around line 451, where polling errors are added to the accumulator and logged. Read the surrounding accumulator and plugin error-handling flow, then determine how the proposed PluginErrorHandler callback fits; done means errors still log and are also delivered to the handler, with coverage for that behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- observability-sre
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100