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

Logql stdin support only log queries #4606

Merged
merged 20 commits into from
Nov 18, 2021
Merged

Logql stdin support only log queries #4606

merged 20 commits into from
Nov 18, 2021

Conversation

kavirajk
Copy link
Contributor

@kavirajk kavirajk commented Nov 1, 2021

What this PR does / why we need it:
Add support for --stdin CLI flag for Loki, to read log data without requiring loki servers.
It was a followup idea from last hackathon!

NOTE: Currently we just support log queries (metrics are not supported yet)

Which issue(s) this PR fixes:
Fixes # partly #3393

Special notes for your reviewer:

Checklist

  • Documentation added
  • Tests updated
  • Add an entry in the CHANGELOG.md about the changes.

@kavirajk kavirajk changed the title Logql stdin support only log queries Logql stdin support only log queries Nov 1, 2021
@kavirajk kavirajk marked this pull request as ready for review November 4, 2021 17:12
@kavirajk kavirajk requested review from KMiller-Grafana and a team as code owners November 4, 2021 17:12
@KMiller-Grafana
Copy link
Contributor

  • Do the examples within the documentation need the --stdin flag as part of the logcli query?
  • The example help output on the documentation page needs to be updated to include the new --stdin flag (where appropriate).

@kavirajk
Copy link
Contributor Author

kavirajk commented Nov 5, 2021

@KMiller-Grafana Addressed your comments!

@kavirajk kavirajk requested review from a team, slim-bean and cyriltovena and removed request for a team November 16, 2021 08:25
Copy link
Contributor

@jeschkies jeschkies left a comment

Choose a reason for hiding this comment

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

I'm really excited about this. Please see my comments below.

cmd/logcli/main.go Show resolved Hide resolved
docs/sources/getting-started/logcli.md Outdated Show resolved Hide resolved
docs/sources/getting-started/logcli.md Show resolved Hide resolved
cmd/logcli/main.go Show resolved Hide resolved
pkg/logcli/client/file.go Outdated Show resolved Hide resolved
Add flag to choose what kind of client to make request to.

Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
Issue was with default value of `step` (1 nanosecond).
StepEvaluator try to go through every nanosecond to apply aggregate on sample data
during the metric queries.

Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
1. Add `--stdin` in examples of the usage
2. Add `--stdin` in all the command help output
- Use parsed labels correctly
- Fix indendation with --stdin flag
Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

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

LGTM

@dannykopping dannykopping merged commit 94113ee into grafana:main Nov 18, 2021
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.

5 participants