-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Expose optional label matcher for label values handler #8824
Expose optional label matcher for label values handler #8824
Conversation
Hello @periklis!
Please, if the current pull request addresses a bug fix, label it with the |
Hello @periklis!
Please, if the current pull request addresses a bug fix, label it with the |
@jeschkies @DylanGuedes Considering on how long we have #4933 in our code base remaining unexposed it may still be buggy returning duplicate label values when using a regex label matcher. Assuming you use the k8s pod names as labels which are per se always unique, I want to filter the values for a set of namespaces I pass to labels values API via a regex matcher, e.g. 4 namespaces each 5 pods:
The resulting list includes duplicates (in total 25 pod names, of which 5 are duplicates): [
"logger-57f5c5f65d-2wvh6",
"logger-57f5c5f65d-4tm75",
**"logger-57f5c5f65d-64pnf",**
** "logger-57f5c5f65d-64pnf",**
"logger-57f5c5f65d-6kr2n",
"logger-57f5c5f65d-7mpdb",
"logger-57f5c5f65d-8lqng",
"logger-57f5c5f65d-9njgp",
"logger-57f5c5f65d-c5xv7",
**"logger-57f5c5f65d-cbzpg",**
**"logger-57f5c5f65d-cbzpg",**
"logger-57f5c5f65d-dmw8k",
"logger-57f5c5f65d-g658h",
"logger-57f5c5f65d-kcvpm",
"logger-57f5c5f65d-mfbmf",
**"logger-57f5c5f65d-p2n5x",**
**"logger-57f5c5f65d-p2n5x",**
"logger-57f5c5f65d-q7h6d",
**"logger-57f5c5f65d-r72wk",**
**"logger-57f5c5f65d-r72wk",**
"logger-57f5c5f65d-t8nlk",
"logger-57f5c5f65d-t9tl9",
**"logger-57f5c5f65d-ttkkh",**
**"logger-57f5c5f65d-ttkkh",**
"logger-57f5c5f65d-wj6lj"
] I have tried to debug this adding some matchers tests in f8ee569 for the |
pkg/querier/queryrange/codec_test.go
Outdated
require.Equal(t, ctx, got.Context()) | ||
require.Equal(t, "/loki/api/v1/labels/__name__/values", got.URL.Path) | ||
// require.Equal(t, fmt.Sprintf("%d", start.UnixNano()), got.URL.Query().Get("start")) | ||
// require.Equal(t, fmt.Sprintf("%d", end.UnixNano()), got.URL.Query().Get("end")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's up with commented lines? Is this WIP?
[docs team] So, looking at both this PR and #4933, and there's just a single line of new documentation? I feel like this needs more doc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've got a few tiny open questions. Otherwise it looks good.
As for your error. Do you get duplicates without passing label marchers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, just a few nits
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-8824-to-release-2.7.x origin/release-2.7.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 1bcf683513b5e11fb1dcc5625761b9760cfbd958
# Push it to GitHub
git push --set-upstream origin backport-8824-to-release-2.7.x
git switch main
# Remove the local backport branch
git branch -D backport-8824-to-release-2.7.x Then, create a pull request where the |
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-8824-to-release-2.8.x origin/release-2.8.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 1bcf683513b5e11fb1dcc5625761b9760cfbd958
# Push it to GitHub
git push --set-upstream origin backport-8824-to-release-2.8.x
git switch main
# Remove the local backport branch
git branch -D backport-8824-to-release-2.8.x Then, create a pull request where the |
(cherry picked from commit 1bcf683)
#8824) (#8960) **What this PR does / why we need it**: This is a backport of #8824 into release-2.8 **Which issue(s) this PR fixes**: Fixes #<issue number> **Special notes for your reviewer**: (cherry picked from commit 1bcf683) **Checklist** - [x] Reviewed the [`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md) guide (**required**) - [x] Documentation added - [x] Tests updated - [x] `CHANGELOG.md` updated - [ ] Changes that require user attention or interaction to upgrade are documented in `docs/sources/upgrading/_index.md`
(cherry picked from commit 1bcf683)
What this PR does / why we need it:
This is a follow-up to expose the optional matchers on the labels values API to the HTTP handler introduced by #4933
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Currently this works on the querier http API directly. However I still fail to pass the query from the frontend tripperware down the stack when request encoding happens. @jeschkies any advise welcome.In addition I err to rename the parameter from
query
tomatch
. However I hesitated to do so as per theLokiLabelNamesRequest
implementing thequeryrangebase/Request
interface that in turns includes aQuery()
method.Checklist
CONTRIBUTING.md
guide (required)CHANGELOG.md
updateddocs/sources/upgrading/_index.md