grafana / loki

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

chore: [k209] fix(retry): fix retries when using protobuf encoding #13358

Closed grafanabot closed 5 days ago

grafanabot commented 5 days ago

Backport a457c5d171d5ffa0a7060c98a8bc48abd735911a from #13316


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