-
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
LogQL: Vector and Range Vector Aggregation. #654
Conversation
020c665
to
adba79b
Compare
@tomwilkie This is ready to review a final time. I've added a bunch of tests around LogQL evaluation and everything looks good. There are scalar and more complex arithmetic operations still not done, or even the extract function but I'd like to start with this first. Overall I think the current structure will support those two easily. 🙏 |
10cfa85
to
e7d307b
Compare
Examples: | ||
|
||
```bash | ||
$ curl -G -s "http://localhost:3100/api/v1/query_range" --data-urlencode 'query=sum(rate({job="varlogs"}[10m])) by (level)' --data-urlencode 'step=300' | jq |
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.
can we use /api/loki/api/v1/query_range ? @tomwilkie @slim-bean
Requirement :
- we need a unique prefix to the path
- we can point golang client at this endpoint.
- should be similar to cortex api
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.
This is awesome!
- adds avg,min,max,top,bottomk,stddev,stdvar,count - updates api documentation - adds tests Improve yacc & go lexer to understand duration Remove support for regexp in all queries Clean up querier and logselector
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
2a08a4c
to
9e2835d
Compare
I'm trying to retrofit regexp query string. |
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!
- keep supporting regex for old endpoint. - use reserved keyword for removed property in grpc
2826f30
to
5faefdd
Compare
This adds vector and range vector aggregation. I've exposed two new endpoint
/api/v1/query
for instant query and/api/v1/query_range
for query over a range of time.I've kept the old endpoint for range logs at
/api/prom/query
because new endpoints have different response structure and this would break Grafana integration. /cc @davkalExamples of new query possible:
count_over_time({job="mysql"}[5m])
total count of log line recorded over the last 5mrate(({job="mysql"} |= "error")[1m])
rate of log line containingerrors
over the last minute.avg(rate(({app="nginx"} |= "GET")[1m])) by (cluster)
average rate of http GET requests by cluster.For now the step evaluation is dictated by the range vector iterator as this is the only one we required and the root AST node is responsible for giving back the result. This might need to change for
extract
or unary operator.Performance wise, the biggest bottleneck is retrieving all sample and deduping them. I've also notice a lot of GC while doing large queries but this is due to the fact that we're throwing away all log line very quickly.
Documentation is up to date, next steps will be to work on the
extract
function allowing to extract sample from log line.