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

[APM Datadog] return 429 specific error #552

Merged
merged 3 commits into from
Dec 15, 2021
Merged
Changes from 1 commit
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
11 changes: 5 additions & 6 deletions plugins/builtin/apm/datadog/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,14 @@ func (a *APMPlugin) QueryMultiple(q string, r sdk.TimeRange) ([]sdk.TimestampedM
Query(q).
Execute()
if err != nil {
if res.StatusCode == http.StatusTooManyRequests {
return nil,
fmt.Errorf("metric queries are ratelimited in current time period by datadog, resets in %s sec",
res.Header.Get(ratelimitResetHdr))
}
return nil, fmt.Errorf("error querying metrics from datadog: %v", err)
}

if res.StatusCode == http.StatusTooManyRequests {
return nil,
fmt.Errorf("metric queries are ratelimited in current time period by datadog, resets in %s sec",
res.Header.Get(ratelimitResetHdr))
}

series := queryResult.GetSeries()
if len(series) == 0 {
a.logger.Warn("empty time series response from datadog, try a wider query window")
Expand Down