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

Loki: Fixes incorrect query result when querying with start time == end time #8979

Merged
merged 2 commits into from
Mar 31, 2023

Conversation

slim-bean
Copy link
Collaborator

@slim-bean slim-bean commented Mar 31, 2023

What this PR does / why we need it:

In several places within Loki we need to determine if a query is a range query or instant query, this is done by checking to see if the start and end time are equal and the step=0

The downstream handler was not checking for step=0 and thus it incorrectly mapped a range query to an instant query when a query has a start time equal to and end time.

There are a few other things at play here, mainly that we should really error anytime someone tries to run an instant query for logs which would have exposed this error much more easily. But that's something I'd like to handle in a different PR as it will be considered a breaking change depending on how we do it.

This PR uses an existing function we have for testing the query type and addresses the issue found in #8885

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

Special notes for your reviewer:

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • CHANGELOG.md updated
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/upgrading/_index.md

Signed-off-by: Edward Welch <edward.welch@grafana.com>
@slim-bean slim-bean requested a review from a team as a code owner March 31, 2023 14:00
Signed-off-by: Edward Welch <edward.welch@grafana.com>
@MasslessParticle MasslessParticle merged commit b892cad into main Mar 31, 2023
@MasslessParticle MasslessParticle deleted the fix-start-equals-end branch March 31, 2023 15:42
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.

Logs returned when start equals end
2 participants