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

Fix regression: Returning "null" for empty matrix results in some cases. #13993

Closed
wants to merge 1 commit into from

Conversation

alanprot
Copy link
Contributor

@alanprot alanprot commented Apr 25, 2024

Seems like 2f03acb introduced a regression where we before returned [] form empty results and we are returningnull on the serialized response:

To reproduce we can run a simple range query with bottomK and a metric that does no exists (ex: bottomk(2, doNotExists):
Before:

{"resultType":"matrix","result":[]}

After the change:

{"resultType":"matrix","result":null}

This is problematic as the prometheus client cannot deserialize this result (screenshot attached). we found the issue when updating prometheus on cortex and the fuzzy tests started to fail.

https://github.com/cortexproject/cortex/actions/runs/8826947786/job/24233899882

Screenshot 2024-04-25 at 11 57 24 AM

Im not sure if this is the right fix but im creating the issue anyway to highlight the issue.

cc @bboreham

Signed-off-by: alanprot <alanprot@gmail.com>
@aknuds1
Copy link
Contributor

aknuds1 commented Apr 26, 2024

we are not returning null on the serialized response

I assume you mean we are now returning null on the serialized response?

@ArthurSens
Copy link
Member

👋

Is this something we want to include in the 2.52 release? If yes, could you change the base branch to 'release-0.52'?

Copy link
Contributor

@aknuds1 aknuds1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks sensible to me at least, but maybe we should get @bboreham's input also?

@alanprot
Copy link
Contributor Author

👋

Is this something we want to include in the 2.52 release? If yes, could you change the base branch to 'release-0.52'?

I don’t think this change was included in the release .. I may be wrong .

we are not returning null on the serialized response

I assume you mean we are now returning null on the serialized response?

Yeah… I will update the description :)

@aknuds1
Copy link
Contributor

aknuds1 commented Apr 26, 2024

I don’t think this change was included in the release .. I may be wrong .

Isn't Bryan's commit part of the release-2.52 branch? @ArthurSens WDYT?

@ArthurSens
Copy link
Member

Yeah, I believe it does 😬. v2.52 is the only release branch with the buggy commit

image

@aknuds1
Copy link
Contributor

aknuds1 commented Apr 26, 2024

Wow nice git-fu there @ArthurSens, I didn't know it.

@ArthurSens
Copy link
Member

Wow nice git-fu there @ArthurSens, I didn't know it.

I discovered this 5mins ago after asking google 😝

Copy link
Member

@bboreham bboreham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for finding this and submitting a fix.

I have no complaints about the code, but I think it should be commented to note that it does this specific thing in order to avoid null in JSON. Also the test should note that client libraries cannot parse null in the response. Otherwise some future change will recreate the problem and not have the context.

@bboreham
Copy link
Member

ref #13744

@bboreham
Copy link
Member

I have proposed an alternative fix in #13997, which I think is a more general approach.

@alanprot
Copy link
Contributor Author

I have proposed an alternative fix in #13997, which I think is a more general approach.

Np... Should i close this one?

@alanprot
Copy link
Contributor Author

alanprot commented Apr 29, 2024

Closing this in favor of #13997

@alanprot alanprot closed this Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants