grafana / loki

Like Prometheus, but for logs.
https://grafana.com/loki
GNU Affero General Public License v3.0
22.71k stars 3.3k forks source link

fix(retry): fix retries when using protobuf encoding #13316

Closed ashwanthgoli closed 11 hours ago

ashwanthgoli commented 6 days ago

What this PR does / why we need it: retry.go expects the Details field of grpc status to be populated which it then uses to read the http response code, it fallbacks to retrying if this field is not set.

But with protobuf encoding Details is not populated and loki retries 4xxs. I do not think it is necessary to set this.

httpgrpc.HTTPResponseFromError gets the Status from the error and additionally tries to decode the http response from Details field. But all retry.go needs is the Code from Status field which would be set for both encoding formats, so replacing this call with status.FromError() which only pulls out the Status from error should fix the retry behaviour.

references:

Which issue(s) this PR fixes: Fixes #

Special notes for your reviewer:

Checklist

grafanabot commented 13 hours ago

This PR must be merged before a backport PR will be created.

grafanabot commented 13 hours ago

This PR must be merged before a backport PR will be created.