influxdata/telegraf

Need a PluginErrorHandler interface or something that telegraf can callback when it fails to poll for metrics.

Open

#10,245 创建于 2021年12月8日

在 GitHub 查看
 (14 评论) (2 反应) (0 负责人)Go (4,161 fork)batch import
area/agentfeature requesthelp wantedsize/l

仓库指标

Star
 (9,892 star)
PR 合并指标
 (平均合并 2天 12小时) (30 天内合并 136 个 PR)

描述

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.

贡献者指南