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

bugfix: add missing comma in vector/matrix array #14047

Merged
merged 3 commits into from May 3, 2024

Conversation

amirvejahat
Copy link
Contributor

@amirvejahat amirvejahat commented May 3, 2024

Fixes #14040
Fixes #14011

@ArthurSens
Copy link
Member

ArthurSens commented May 3, 2024

We require that all commits are properly signed, could you run git commit --amend -s and force push again?

Also, we want to include this fix on the release branch release-2.52. Could you update the base branch for this PR?

@bboreham
Copy link
Member

bboreham commented May 3, 2024

Ideally we would add a test which failed on the previous code too.

@amirvejahat
Copy link
Contributor Author

We require that all commits are properly signed, could you run git commit --amend -s and force push again?

Also, we want to include this fix on the release branch release-2.52. Could you update the base branch for this PR?

Sure, will do

@amirvejahat amirvejahat changed the base branch from main to release-2.52 May 3, 2024 13:01
@ArthurSens
Copy link
Member

I've tested the change locally and it works, but it looks like you've got some extra commits in here by accident 😅

What you wanna do is:

  • Clone the repo and checkout the branch release-2.52
  • Create a new branch from release-2.52
  • Add your changes in a commit (remember to sign, using the -s flag)
  • Open a Pull Request with release-2.52 as the base branch.

You can do this in a new PR, or you can force push commits over here. It's up to you

Signed-off-by: Amir Vejahat <amir.vejahat.av@gmail.com>
@amirvejahat
Copy link
Contributor Author

Thanks for the help @ArthurSens . I've fixed the branching issue. please note that circleci has failed due to project suspension, I'm not sure if there's anything I could do to make it work.

Copy link
Member

@ArthurSens ArthurSens left a comment

Choose a reason for hiding this comment

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

Thanks @amirvejahat, one last thing.

As Bryan mentioned, it would be nice to have a test case to make sure we don't make this mistake again in the future.

You can add a new test case in web/api/v1/json_codec.go, inside the test TestJsonCodec_Encode

{
			response: &QueryData{
				ResultType: parser.ValueTypeVector,
				Result: promql.Vector{
					promql.Sample{
						Metric: labels.FromStrings("__name__", "foo"),
						T:      1000,
						F:      1,
					},
					promql.Sample{
						Metric: labels.FromStrings("__name__", "bar"),
						T:      2000,
						F:      2,
					},
				},
			},
			expected: `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"foo"},"value":[1,"1"]},{"metric":{"__name__":"bar"},"value":[2,"2"]}]}}`,
		},

@ArthurSens
Copy link
Member

Thanks for the help @ArthurSens . I've fixed the branching issue. please note that circleci has failed due to project suspension, I'm not sure if there's anything I could do to make it work.

Yeah, the failing CI is not related to this PR... no need to worry about it :)

@gotjosh
Copy link
Member

gotjosh commented May 3, 2024

Hi @amirvejahat at the moment this is breaking main so it's rather sensitive - I'll aim to add some tests in the next 30m unless you respond first so that we can keep going.

Thank you again for your contribution!

Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
@ArthurSens
Copy link
Member

ArthurSens commented May 3, 2024

@gotjosh , I've just added the test. Do you mind reviewing it?

EDIT: Looks like another test could be added for matrixes 🤔

Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
Copy link
Member

@gotjosh gotjosh left a comment

Choose a reason for hiding this comment

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

LGTM

Thank you @ArthurSens!

@ArthurSens ArthurSens merged commit 56fd8a1 into prometheus:release-2.52 May 3, 2024
29 checks passed
@ArthurSens
Copy link
Member

Thanks @amirvejahat for the fix and sorry for taking over the PR, we just wanted to get this fixed soon :)

@gotjosh
Copy link
Member

gotjosh commented May 3, 2024

This now needs to be merged back into main.

@ArthurSens
Copy link
Member

ArthurSens commented May 3, 2024

Yeah, I've just created the PR to prepare the new release and another PR merging it back to main will follow shortly after

@amirvejahat
Copy link
Contributor Author

Thanks @ArthurSens for adding the test case, I was away from my keyboard. glad to see it's merged now. looking forward to future contribution.

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.

None yet

4 participants