-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
I think this is a bug that we don't check status code before we start to do things in our client APIs code against Prometheus. Related discussion: #755 (comment)
The problem is that users can access the API through various proxies, so we can easily get 404, 403, and other 4xx or 5xx code without proper return type. This will cause very confusing unmarshalling error without even mentioning the response code. I think this is quite a serious problem and something that potential blocks Thanos to switch to those APIs.
AC:
- Code like this https://github.com/prometheus/client_golang/blob/master/api/prometheus/v1/api.go#L568 should never ignore status code
- Make sure Body is always closed and exhausted (I am not sure if unmarshall gives us that)
Help wanted, I can guide someone through.
lilic