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

support match[] encoding #1875

Merged
merged 1 commit into from
Mar 31, 2020
Merged

Conversation

owen-d
Copy link
Member

@owen-d owen-d commented Mar 31, 2020

Supports a combination of match and match[] in encoding multiple match params (for Prometheus compatibility and because I used match during the initial implementation).

Closes #1842

@owen-d
Copy link
Member Author

owen-d commented Mar 31, 2020

/cc @yeya24 @cyriltovena

@owen-d
Copy link
Member Author

owen-d commented Mar 31, 2020

ugh, I didn't notice #1862

Sorry :(

@yeya24
Copy link
Contributor

yeya24 commented Mar 31, 2020

I think I can close mine. 😄

Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

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

LGTM

ys := r.Form["match[]"]

deduped := union(xs, ys)
sort.Strings(deduped)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can I ask why sorting is required?

Copy link
Member Author

@owen-d owen-d Mar 31, 2020

Choose a reason for hiding this comment

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

I did it for deterministic tests, but you're totally right - I could just sort it in the test. Good catch @yeya24

Edit: actually it looks a bit harder to sort it in tests and the runtime cost is minimal, so I'll leave it for simplicity.

@owen-d owen-d merged commit 726b8cd into grafana:master Mar 31, 2020
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.

Series API should support match[] encoding
3 participants