Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass warning back from response so we can tell if there is a problem with prometheus #648

Closed
wants to merge 2 commits into from

Conversation

eroteme
Copy link

@eroteme eroteme commented Oct 4, 2019

@krasi-georgiev
Was having a problem with prometheus not giving back expected results. Seems that warnings where always passing back nil (from the client). So added a simple fix to merge the warnings back from the client with warnings back rom the response.

Signed-off-by: Brian Gibbins brian.eroteme@gmail.com

Brian Gibbins and others added 2 commits October 4, 2019 12:10
Signed-off-by: Brian Gibbins <briangibbins@rentalcars.com>
… back from api (always nil atm)

Signed-off-by: Brian Gibbins <briangibbins@rentalcars.com>
@krasi-georgiev
Copy link
Contributor

krasi-georgiev commented Oct 9, 2019

I wonder (c *httpClient) Do doesn't handle the warnings there?

@beorn7 beorn7 self-requested a review October 21, 2019 17:14
@joe-elliott
Copy link
Contributor

joe-elliott commented Oct 27, 2019

As you mentioned warnings is hardcoded to nil in the client:
https://github.com/prometheus/client_golang/blob/master/api/client.go#L123

Is there any reason to not just remove this from the interface/client? What meaningful warning could this return that would not just be an error?

Regarding the change in question. I would like to see the prometheus warnings returned from apiClient Do method.

@beorn7, IMO the full change should be:

@beorn7
Copy link
Member

beorn7 commented Oct 28, 2019

Thanks @joe-elliott for all the insight. I have a closer look ASAP.

@beorn7
Copy link
Member

beorn7 commented Nov 25, 2019

First of all, my apologies for the long delay. It was a really busy month full of conferences.

@joe-elliott what you are writing makes sense to me. The warnings in the "top level" client were introduced in 1335ef4 by @jacksontj .

@jacksontj was there a reason to have warnings in the api.Client.Do method?

If not, I'd just go forward with @joe-elliott 's suggestions.

Thanks, everyone.

@jacksontj
Copy link
Contributor

The warnings should be passed back -- they were initially added in #562 so the warnings shouldn't always be nil -- how can I reproduce the error you are seeing (not getting warnings back)?

@beorn7
Copy link
Member

beorn7 commented Nov 25, 2019

It looks to me that the methods of api.Client always return nil for the warnings. @jacksontj can you point me to any code path where that's not the case?

This PR illustrates where warnings are not propagated, i.e. result.Warnings is never accessed.

@jacksontj
Copy link
Contributor

@beorn7 re-reading the code I also don't see how it ever worked. It seems that the tests there pass because it mocks out the client as well -- so not a great test.

So +1 from me for this PR :)

@beorn7
Copy link
Member

beorn7 commented Nov 26, 2019

Thanks for clarifying.

I still think we should do wath @joe-elliott suggested. @eroteme are you up for it? Otherwise, @joe-elliott or I could do it.

@beorn7
Copy link
Member

beorn7 commented Dec 11, 2019

@joe-elliott has kindly picked up this issue and created #699, which supersedes this PR.

@beorn7 beorn7 closed this Dec 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants