Skip to content

Commit

Permalink
Add support to handle 402 and 413 http error code in Otlp exporter op…
Browse files Browse the repository at this point in the history
…en-telemetry#5674

 - added StatusRequestEntityTooLarge (413) and StatusPaymentRequired (402) as failure permanent
  • Loading branch information
mcmho committed Jul 14, 2022
1 parent a831d51 commit 49bd5d5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion exporter/otlphttpexporter/otlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ func (e *exporter) export(ctx context.Context, url string, request []byte) error
return exporterhelper.NewThrottleRetry(formattedErr, time.Duration(retryAfter)*time.Second)
}

if resp.StatusCode == http.StatusBadRequest {
// do not retry these errors
if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusRequestEntityTooLarge ||
resp.StatusCode == http.StatusPaymentRequired {
// Report the failure as permanent if the server thinks the request is malformed.
return consumererror.NewPermanent(formattedErr)
}
Expand Down

0 comments on commit 49bd5d5

Please sign in to comment.