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

[query] Add tag completion HTTP endpoint onto query #1175

Merged
merged 9 commits into from
Nov 20, 2018

Conversation

arnikola
Copy link
Collaborator

Adds the endpoint to query which will allow tag completion

@codecov
Copy link

codecov bot commented Nov 14, 2018

Codecov Report

Merging #1175 into master will decrease coverage by <.1%.
The diff coverage is 26.5%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #1175     +/-   ##
========================================
- Coverage    71.1%     71%   -0.1%     
========================================
  Files         737     734      -3     
  Lines       61854   61684    -170     
========================================
- Hits        43994   43848    -146     
  Misses      15011   15011             
+ Partials     2849    2825     -24
Flag Coverage Δ
#aggregator 81.6% <ø> (-0.1%) ⬇️
#cluster 85.8% <ø> (+0.1%) ⬆️
#collector 78.1% <ø> (ø) ⬆️
#dbnode 80.9% <ø> (+0.1%) ⬆️
#m3em 73.2% <ø> (ø) ⬆️
#m3ninx 75.3% <ø> (ø) ⬆️
#m3nsch 51.1% <ø> (ø) ⬆️
#metrics 18.3% <ø> (ø) ⬆️
#msg 74.9% <ø> (ø) ⬆️
#query 61.4% <26.5%> (-0.3%) ⬇️
#x 75.2% <ø> (+0.7%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 845d75e...7cd1ebe. Read the comment docs.

FilterNameTags: [][]byte{nameBytes},
TagMatchers: models.Matchers{
models.Matcher{
Type: models.MatchEqual,
Copy link
Contributor

Choose a reason for hiding this comment

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

MatchRegexp ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Prom supports exact matchers for this endpoint

Copy link
Contributor

Choose a reason for hiding this comment

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

as discussed, making it MatchEqual will fail the Matches() call

if len(ss) > 2 {
return Matcher{}, errors.New("invalid arg length for matcher")
}
fmt.Println(l)
Copy link
Contributor

Choose a reason for hiding this comment

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

remove ?


if l == 1 {
return Matcher{
Type: MatchEqual,
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a bit weird since you can in theory also have match not equal, match regex, etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Addressed in the TODO; this is a bit annoying to do since it requires query parsing on our side

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we may want to leave this until we add in m3ql parsing since we'll be able to use the query parsing from that codebase here

Copy link
Contributor

Choose a reason for hiding this comment

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

i think we can have MatchRegex in prom too!

if b.nameOnly {
for name := range b.tagBuilders {
result = append(result, CompletedTag{Name: []byte(name)})
Copy link
Contributor

Choose a reason for hiding this comment

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

oops, did it break any test now ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was only added in this PR; once tests were added it failed a few

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good

FilterNameTags: [][]byte{nameBytes},
TagMatchers: models.Matchers{
models.Matcher{
Type: models.MatchEqual,
Copy link
Contributor

Choose a reason for hiding this comment

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

as discussed, making it MatchEqual will fail the Matches() call


if l == 1 {
return Matcher{
Type: MatchEqual,
Copy link
Contributor

Choose a reason for hiding this comment

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

i think we can have MatchRegex in prom too!

if err != nil {
return nil, err
}
fmt.Println(matcher)
Copy link
Contributor

Choose a reason for hiding this comment

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

remove ?

if b.nameOnly {
for name := range b.tagBuilders {
result = append(result, CompletedTag{Name: []byte(name)})
Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good

// TODO: make this more robust, handle types other than MatchEqual
func matcherFromString(s string) (Matcher, error) {
ss := strings.Split(s, ":")
l := len(ss)
Copy link
Contributor

Choose a reason for hiding this comment

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

call it length ?

func matcherFromString(s string) (Matcher, error) {
ss := strings.Split(s, ":")
l := len(ss)
if len(ss) > 2 {
Copy link
Contributor

Choose a reason for hiding this comment

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

u already have a variable for that

Copy link
Collaborator Author

@arnikola arnikola Nov 20, 2018

Choose a reason for hiding this comment

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

I just wanted to bump by characters per commit metrics 😛

@arnikola arnikola merged commit d690dc0 into master Nov 20, 2018
@arnikola arnikola deleted the arnikola/tag-completion-endpoint branch November 20, 2018 19:52
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.

2 participants