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

logcli: Fix handling of logcli query using --since/--from and --tail #3270

Merged
merged 2 commits into from
Feb 1, 2021

Conversation

chancez
Copy link
Contributor

@chancez chancez commented Jan 29, 2021

What this PR does / why we need it:
Fixes handling of --since/--from in logcli query when used with --tail.

Also changes uses of variable names in the logcli Client interface to match the
query parameter names for the Loki API for consistency.

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

…uery parameters

Instead of using from/through, use start/end like the Loki API does.
qsb := util.NewQueryStringBuilder()
qsb.SetString("query", queryStr)
qsb.SetInt("delay_for", int64(delayFor))
qsb.SetInt("limit", int64(limit))
qsb.SetInt("from", from)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was the bug

Copy link
Contributor

@sandeepsukhani sandeepsukhani left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!
LGTM

@sandeepsukhani sandeepsukhani merged commit 91974e0 into grafana:master Feb 1, 2021
@chancez chancez deleted the logcli_fix_tail_from branch February 1, 2021 17:08
cyriltovena pushed a commit to cyriltovena/loki that referenced this pull request Jun 11, 2021
Signed-off-by: Ben Wells <b.v.wells@gmail.com>
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.

Logcli query --tail incorrectly handles --since/--from
2 participants