-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Interval parameter for log queries #1779
Comments
I've been waffling about the idea of supporting both actually, that way if clients want to be able to issue queries using |
Personally between the two, I think the header is the right way to go. In general, I agree that setting a header is a little tedious but tooling helps with making this easy. Arguably, I'd say URLs are already not easy to write if your query is sufficiently complicated. Another option might be to introduce the functionality as another API endpoint, something like |
After some discussions and thinking about this for a bit. I'm moving farther away from using It seems something more like |
This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
step
parameter for log queriesinterval
parameter for log queries
interval
parameter for log queries
#1965 adds support for an ** Downsampling of a log stream to return results >= requested interval ** Note, it does not fill in missing values, the logic just looks for the next entry which is >= interval. After some discussions with @cyriltovena we both agreed there is probably a better store here for implementing this via LogQL, something like a function In this implementation step can be used to accomplish what This feels like a more natural solution to the problem within the LogQL language. That being said, we are going to merge #1965 in an experimental state to get feedback and make this capability available now. Any users of |
Will revist this at a later date, closing as it's not relevant at this time. |
My use case for Some way to limit the number of samples per time is necessary to make sure that even if the line limit is reached the full time range of the query is covered. We currently implement this with a dynamic values for the Edit: turns out interval is broken for our use case, see #5613 |
Recently I created #1773 and after merging realized that Grafana defaults to sending a
step
with log queries. I would consider this a bug but be that as it may keeping #1773 would result in some pretty nasty unexpected behavior when using Grafana against Loki (even if we fixed Grafana old versions would still be sending this parameter)#1773 was reverted by #1777 however I would still like to add this feature and I can think of a couple ways to do it:
log_step
Accept: application/json;version=2
Some more thoughts:
I think the
step
functionality is worth having in Loki. While Loki is a logs database, more specifically it is a string database extended from a metric database (Cortex) and I think it's a valid use case to store string style metrics in Loki (e.g. GPS coordinates, or a more complex json doc of metrics), as such thestep
parameter is of great value at query time to allow range queries which return sane result sizes over different time periods.At this point it's much too dangerous to just start using the "step" for log style queries, we use it correctly for metric style queries but previously it was just ignored by Loki for log queries.
I think of the two approaches mentioned above, I prefer the new parameter
log_step
for a few reasons, first it makes URL's easy to write and send (setting a header is tedious), second within our code there were also assumptions made about the use of step only being for metric queries and as a result it has specific rules applied to it which don't apply to log queries. #1773 handled this by parsing the query very early to determine the type before applying these rules to the incoming step parameter. Using a new parameter would make it more obvious which rules are applied and why within the Loki codebase.Looking for thoughts/feedback.
The text was updated successfully, but these errors were encountered: