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: Implement step editor #69648
Loki: Implement step editor #69648
Conversation
Backend code coverage report for PR #69648
|
Frontend code coverage report for PR #69648
|
hmm I didn't tested with split duration + split queries, so I'll have a look at that. Does it happen if you have split toggles off? |
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.
Looks good to me! I left a couple of suggestions.
public/app/plugins/datasource/loki/querybuilder/components/LokiQueryBuilderOptions.tsx
Outdated
Show resolved
Hide resolved
public/app/plugins/datasource/loki/querybuilder/components/LokiQueryBuilderOptions.tsx
Show resolved
Hide resolved
…iQueryBuilderOptions.tsx Co-authored-by: Matias Chomicki <matyax@gmail.com>
**What this PR does / why we need it**: In grafana/grafana#69648 we are in Grafana introducing a step editor in Loki. Unfortunately, the error message when user sets too low step parameter is hard to understand, so I am proposing following change to make it more understandable and actionable. Let me know what do you think. --------- Co-authored-by: J Stickler <julie.stickler@grafana.com>
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.
Query splitting changes look great! Left a comment.
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.
👏 👏
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 👍 , but i'd recommend not doing template-variables in step-field, at least not in the initial version.
public/app/plugins/datasource/loki/querybuilder/components/LokiQueryBuilderOptions.tsx
Show resolved
Hide resolved
* Loki: Implement step editor * Update to keep value * Remove console.log * Remove white space * Update public/app/plugins/datasource/loki/querybuilder/components/LokiQueryBuilderOptions.tsx Co-authored-by: Matias Chomicki <matyax@gmail.com> * Import trim * Update using of step in split queries * Add tests * Add tests * Remove step interpolation --------- Co-authored-by: Matias Chomicki <matyax@gmail.com>
* Loki: Implement step editor * Update to keep value * Remove console.log * Remove white space * Update public/app/plugins/datasource/loki/querybuilder/components/LokiQueryBuilderOptions.tsx Co-authored-by: Matias Chomicki <matyax@gmail.com> * Import trim * Update using of step in split queries * Add tests * Add tests * Remove step interpolation --------- Co-authored-by: Matias Chomicki <matyax@gmail.com>
What is this feature?
In this PR we are adding
step
editor to Loki query editor. With a newstep
editor, users can set the value forstep
. It accepts durations (e.g. 1s, 1d, 1h), numbers and $__interval or $__range variables.If the user set up the step, we use it. We don't do
safeStep
evaluation on it, because we wantstep
input to be direct and we don't want "magic where we would adjust step" happening on the backend.I was thinking about adding validation, but I would like to add interpolation of template variables in the next PRs and then validation becomes more tricky, so I decided not to add it (at the moment). Moreover, other step editors (e.g. in Prometheus), also don't have validation, so I don't consider it as MVP and it can be added later (I added it as task in #58337)
Why do we need this feature?
Users would like to set the value of step parameter for metric query.
Who is this feature for?
Loki users who run metric queries
Which issue(s) does this PR fix?:
Part of #58337
Special notes for your reviewer:
step.mov