You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2026-06-03 18:35:08 +02:00
otlptracehttp, otlpmetrichttp: Retry for 502, 504 HTTP statuses (#4670)
This commit is contained in:
@@ -190,7 +190,10 @@ func (d *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc
|
||||
}
|
||||
return nil
|
||||
|
||||
case sc == http.StatusTooManyRequests, sc == http.StatusServiceUnavailable:
|
||||
case sc == http.StatusTooManyRequests,
|
||||
sc == http.StatusBadGateway,
|
||||
sc == http.StatusServiceUnavailable,
|
||||
sc == http.StatusGatewayTimeout:
|
||||
// Retry-able failures. Drain the body to reuse the connection.
|
||||
if _, err := io.Copy(io.Discard, resp.Body); err != nil {
|
||||
otel.Handle(err)
|
||||
|
||||
@@ -95,7 +95,7 @@ func TestEndToEnd(t *testing.T) {
|
||||
}),
|
||||
},
|
||||
mcCfg: mockCollectorConfig{
|
||||
InjectHTTPStatus: []int{503, 503},
|
||||
InjectHTTPStatus: []int{503, 502},
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -110,7 +110,7 @@ func TestEndToEnd(t *testing.T) {
|
||||
}),
|
||||
},
|
||||
mcCfg: mockCollectorConfig{
|
||||
InjectHTTPStatus: []int{503},
|
||||
InjectHTTPStatus: []int{504},
|
||||
InjectResponseHeader: []map[string]string{
|
||||
{"Retry-After": "10"},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user