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

Accept match[] in series API #1862

Closed
wants to merge 1 commit into from
Closed

Conversation

yeya24
Copy link
Contributor

@yeya24 yeya24 commented Mar 29, 2020

Signed-off-by: yeya24 yb532204897@gmail.com

What this PR does / why we need it:

With this match[] support, now we can query the series directly via promtool

➜  promtool query series --match='{job="varlogs"}' 'http://127.0.0.1:3100/loki'   
{filename="/var/log/syslog", job="varlogs"}
{filename="/var/log/Xorg.1.log", job="varlogs"}
{filename="/var/log/parallels.log", job="varlogs"}

Which issue(s) this PR fixes:
Fixes #1842

Special notes for your reviewer:

Checklist

  • Documentation added
  • Tests updated

Signed-off-by: yeya24 <yb532204897@gmail.com>
@codecov-io
Copy link

Codecov Report

Merging #1862 into master will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1862      +/-   ##
==========================================
- Coverage   64.84%   64.82%   -0.02%     
==========================================
  Files         125      125              
  Lines        9423     9424       +1     
==========================================
- Hits         6110     6109       -1     
- Misses       2886     2887       +1     
- Partials      427      428       +1     
Impacted Files Coverage Δ
pkg/loghttp/series.go 85.71% <100.00%> (+1.09%) ⬆️
pkg/logql/evaluator.go 90.69% <0.00%> (-0.59%) ⬇️

"start": []string{"1000"},
"end": []string{"2000"},
"match": []string{`{a="1"}`},
"match[]": []string{`{b="2", c=~"3", d!="4"}`},
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a test with multiple string value from match[].

Just to ensure we support this use case where multiple matches are provided using that new match[].

Like this

curl -g 'http://localhost:9090/api/v1/series?' --data-urlencode 'match[]=up' --data-urlencode 'match[]=process_start_time_seconds{job="prometheus"}'

I think you can do that simply by adding to the array:

"match[]": []string{`{b="2", c=~"3", d!="4"}`,`{a="1"}`},

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure

@owen-d owen-d mentioned this pull request Mar 31, 2020
@yeya24
Copy link
Contributor Author

yeya24 commented Mar 31, 2020

Close this PR because there is a better PR make by @owen-d

@yeya24 yeya24 closed this 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