-
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
Loki: add a 'since' query parameter for easier querying using relative time #7964
Conversation
pkg/logql/downstream_test.go
Outdated
//{`1`, false}, | ||
//{`1 + 1`, false}, | ||
//{`{a="1"}`, false}, | ||
//{`{a="1"} |= "number: 10"`, false}, | ||
//{`rate({a=~".+"}[1s])`, false}, | ||
//{`sum by (a) (rate({a=~".+"}[1s]))`, false}, | ||
//{`sum(rate({a=~".+"}[1s]))`, false}, | ||
//{`max without (a) (rate({a=~".+"}[1s]))`, false}, | ||
//{`count(rate({a=~".+"}[1s]))`, false}, | ||
//{`avg(rate({a=~".+"}[1s]))`, true}, | ||
//{`avg(rate({a=~".+"}[1s])) by (a)`, true}, | ||
//{`1 + sum by (cluster) (rate({a=~".+"}[1s]))`, false}, | ||
//{`sum(max(rate({a=~".+"}[1s])))`, false}, | ||
//{`max(count(rate({a=~".+"}[1s])))`, false}, | ||
//{`max(sum by (cluster) (rate({a=~".+"}[1s]))) / count(rate({a=~".+"}[1s]))`, false}, |
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.
Why are these commented out?
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.
ugh, had some stuff on my working directory I didn't notice when I made this... fixed..
… range Signed-off-by: Edward Welch <edward.welch@grafana.com>
84e22cc
to
430b961
Compare
Signed-off-by: Edward Welch <edward.welch@grafana.com>
./tools/diff_coverage.sh ../loki-target-branch/test_results.txt test_results.txt ingester,distributor,querier,querier/queryrange,iter,storage,chunkenc,logql,loki Change in test coverage per package. Green indicates 0 or positive change, red indicates that test coverage for a package fell. + ingester 0%
+ distributor 0%
+ querier 0%
+ querier/queryrange 0%
+ iter 0%
+ storage 0%
+ chunkenc 0%
+ logql 0%
+ loki 0% |
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 nit/question
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.
Nice. LGTM
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
Signed-off-by: Edward Welch edward.welch@grafana.com
What this PR does / why we need it:
logcli has a command line parameter called
since
which makes it easy to query logs relative to the current time, however this is some syntactic sugar used in logcli to calculatestart
andend
query parameters for the query sent to Loki.This PR adds native support for a
since
query parameter to make it a little easier to consume the Loki query API without having to calculate precise start/end times with every request.This is useful if you are polling the Loki API from a third party app which doesn't let you easily build dynamic URL's and all you want to do is poll for say the last 3 hours of logs.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Checklist
CONTRIBUTING.md
guideCHANGELOG.md
updateddocs/sources/upgrading/_index.md