-
Notifications
You must be signed in to change notification settings - Fork 455
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
[dbnode][coordinator] Support match[] in label endpoints #3180
Merged
Merged
Changes from 24 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
81e9d4f
WIP matchers for label endpoints
robskillington bb694af
Add parsing in endpoints
robskillington f06ce87
Label / label values integration test
wesleyk 2d09465
Add list tags unit test
wesleyk e50225f
Ensure name matcher is included in tag values API
wesleyk 654728a
Add tag values unit test for match[]
wesleyk 06b3eec
Add ability to skip fields altogether if does not match restrict by q…
robskillington 01d7605
Remove sleep
wesleyk bda7d06
Use a separate iterator for fields postings list iterator
robskillington 5f0460d
Return new terms iterable each time
robskillington 7f96eb0
Lookup field postings list from the field data offset
robskillington d3db7a8
Use curr offset always
robskillington 083b3d7
Unmarshal if err == nil
robskillington 4fbfa66
Fixup integration test assertions
wesleyk e96015d
Close fieldsIter on filterFieldsIterator.Close()
wesleyk 518005f
Update mocks
wesleyk c283d36
Fixup filter field iterator test
wesleyk b2d5103
Merge branch 'master' into matchers-for-label-endpoints
wesleyk 277f845
Lint
wesleyk 240bde4
Update fields terms iter tests
wesleyk 560063e
Use fake fields postings list iterator for filter fields iterator test
wesleyk 5f52d8e
Add ParseMatch unit test
wesleyk 9758a9c
Lint
wesleyk fdfe854
Add unit tests for fst reader fields postings list
wesleyk bef0c3b
More explicit label assertion
wesleyk 9f0a962
Lint
wesleyk eba6962
Add test for fields iterator postings list match
robskillington f94353d
Merge branch 'master' into matchers-for-label-endpoints
robskillington 74a3e3f
Fix lint
robskillington 9fa98b0
Merge branch 'matchers-for-label-endpoints' of github.com:m3db/m3 int…
robskillington f775ecc
Merge branch 'master' into matchers-for-label-endpoints
robskillington 56f0235
Fix lint
robskillington 98f75e7
Fix not returning err from toSlice
robskillington File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -391,6 +391,47 @@ function test_series { | |
'[[ $(curl -s "0.0.0.0:7201/api/v1/series?match[]=prometheus_remote_storage_samples_total&start=-292273086-05-16T16:47:06Z&end=292277025-08-18T07:12:54.999999999Z" | jq -r ".data | length") -eq 1 ]]' | ||
} | ||
|
||
function test_labels { | ||
TAG_NAME_0="name_0" TAG_VALUE_0="value_0_1" \ | ||
TAG_NAME_1="name_1" TAG_VALUE_1="value_1_1" \ | ||
TAG_NAME_2="name_2" TAG_VALUE_2="value_2_1" \ | ||
prometheus_remote_write \ | ||
label_metric now 42.42 \ | ||
true "Expected request to succeed" \ | ||
200 "Expected request to return status code 200" | ||
|
||
TAG_NAME_0="name_0" TAG_VALUE_0="value_0_2" \ | ||
TAG_NAME_1="name_1" TAG_VALUE_1="value_1_2" \ | ||
prometheus_remote_write \ | ||
label_metric_2 now 42.42 \ | ||
true "Expected request to succeed" \ | ||
200 "Expected request to return status code 200" | ||
|
||
# Test label search with match | ||
ATTEMPTS=5 TIMEOUT=2 MAX_TIMEOUT=4 retry_with_backoff \ | ||
'[[ $(curl -s "0.0.0.0:7201/api/v1/labels?start=0&end=9999999999999.99999" | jq -r ".data | length") -gt 3 ]]' | ||
|
||
ATTEMPTS=5 TIMEOUT=2 MAX_TIMEOUT=4 retry_with_backoff \ | ||
'[[ $(curl -s "0.0.0.0:7201/api/v1/labels?match[]=label_metric&start=0&end=9999999999999.99999" | jq -r ".data | length") -eq 4 ]]' | ||
|
||
ATTEMPTS=5 TIMEOUT=2 MAX_TIMEOUT=4 retry_with_backoff \ | ||
'[[ $(curl -s "0.0.0.0:7201/api/v1/labels?match[]=label_metric_2&start=0&end=9999999999999.99999" | jq -r ".data | length") -eq 3 ]]' | ||
|
||
# Test label values search with match | ||
ATTEMPTS=5 TIMEOUT=2 MAX_TIMEOUT=4 retry_with_backoff \ | ||
'[[ $(curl -s "0.0.0.0:7201/api/v1/label/name_1/values?start=0&end=9999999999999.99999" | jq -r ".data | length") -eq 2 ]]' # two values without a match | ||
|
||
ATTEMPTS=5 TIMEOUT=2 MAX_TIMEOUT=4 retry_with_backoff \ | ||
'[[ $(curl -s "0.0.0.0:7201/api/v1/label/name_1/values?match[]=label_metric&start=0&end=9999999999999.99999" | jq -r ".data | length") -eq 1 ]]' | ||
ATTEMPTS=5 TIMEOUT=2 MAX_TIMEOUT=4 retry_with_backoff \ | ||
'[[ $(curl -s "0.0.0.0:7201/api/v1/label/name_1/values?match[]=label_metric&start=0&end=9999999999999.99999" | jq -r ".data[0]") = "value_1_1" ]]' | ||
|
||
ATTEMPTS=5 TIMEOUT=2 MAX_TIMEOUT=4 retry_with_backoff \ | ||
'[[ $(curl -s "0.0.0.0:7201/api/v1/label/name_1/values?match[]=label_metric_2&start=0&end=9999999999999.99999" | jq -r ".data | length") -eq 1 ]]' | ||
ATTEMPTS=5 TIMEOUT=2 MAX_TIMEOUT=4 retry_with_backoff \ | ||
'[[ $(curl -s "0.0.0.0:7201/api/v1/label/name_1/values?match[]=label_metric_2&start=0&end=9999999999999.99999" | jq -r ".data[0]") = "value_1_2" ]]' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Maybe we don't specify start/end to test that they default to the right min/max values if not specified? |
||
} | ||
|
||
echo "Running readiness test" | ||
test_readiness | ||
|
||
|
@@ -409,6 +450,7 @@ test_prometheus_query_native_timeout | |
test_query_restrict_tags | ||
test_prometheus_remote_write_map_tags | ||
test_series | ||
test_labels | ||
|
||
echo "Running function correctness tests" | ||
test_correctness | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Hm this could start failing if any other global labels are used in metrics sent to the coordinator I believe if
match[]
is not specified?Maybe it would be better to see if the values are contained by the result or not.
I think you can use a reduce and filter statement to get a unique count of the terms you expect and compare against that?
Might end up with a long line obviously but I think that this is probably better than flakey tests. Here's an example:
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.
ah that was the intention of >= 3. Still being explicit would be good so yeah will use that.