Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wavefront output should distinguish between retryable and non-retryable errors #8404

Merged
merged 1 commit into from
Nov 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion plugins/outputs/wavefront/wavefront.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ func (w *Wavefront) Write(metrics []telegraf.Metric) error {
for _, point := range w.buildMetrics(m) {
err := w.sender.SendMetric(point.Metric, point.Value, point.Timestamp, point.Source, point.Tags)
if err != nil {
return fmt.Errorf("Wavefront sending error: %s", err.Error())
if isRetryable(err) {
return fmt.Errorf("Wavefront sending error: %v", err)
}
w.Log.Errorf("non-retryable error during Wavefront.Write: %v", err)
}
}
}
Expand Down Expand Up @@ -355,3 +358,21 @@ func init() {
}
})
}

// TODO: Currently there's no canonical way to exhaust all
// retryable/non-retryable errors from wavefront, so this implementation just
// handles known non-retryable errors in a case-by-case basis and assumes all
// other errors are retryable.
// A support ticket has been filed against wavefront to provide a canonical way
// to distinguish between retryable and non-retryable errors (link is not
// public).
func isRetryable(err error) bool {
if err != nil {
// "empty metric name" errors are non-retryable as retry will just keep
// getting the same error again and again.
if strings.Contains(err.Error(), "empty metric name") {
return false
}
}
return true
}