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
Alerting: Enable preview for recording rules #63260
Conversation
@gillesdemey I'm still working on this PR, but I'd like to have your input so far if you don't mind. |
🍐-ed up with @VikaCep on this one and we think we have a good way forward that allows us to render the |
8a0ae14
to
4335e52
Compare
It reuses QueryEditor and propagates a few properties to allow to filter the visible datasources and customize what's shown in the editor header
Otherwise it would get mixed up with the alert rules queries when switching back and forth from this option. This also allows me to initialize these queries with the right datasource
As now we use the query editor for recording rules which already includes a datasource picker within
4335e52
to
158e721
Compare
public/app/features/alerting/unified/components/rule-editor/AlertRuleForm.tsx
Outdated
Show resolved
Hide resolved
...lerting/unified/components/rule-editor/query-and-alert-condition/QueryAndExpressionsStep.tsx
Outdated
Show resolved
Hide resolved
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.
Very nice!!, I added some comments 👀
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.
Nice one! 🎉
I would try to avoid using the Alternatively, we should tweak the query editor to also work for Prometheus rules so the experience is consistent |
…ew-for-recording-rules
…ew-for-recording-rules
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 nice! 🎉 one nit: I'd add a bit of margin between the query editor and the viz wrapper
I think this one still needs the tests to be updated, code LGTM! |
Failing tests have been addressed and I applied some margin to the |
* Create RecordingRuleEditor component It reuses QueryEditor and propagates a few properties to allow to filter the visible datasources and customize what's shown in the editor header * Set recording rules queries as a new state prop Otherwise it would get mixed up with the alert rules queries when switching back and forth from this option. This also allows me to initialize these queries with the right datasource * Show CloudRulesSourcePicker only for Loki/Mimir rules As now we use the query editor for recording rules which already includes a datasource picker within * Fix lint and tests * Fix saving a recording rule * Show expression when editing the recording rule * Show query editor back for cloud rules * Fix duplicated import * Tweak after rebase * Remove ts-ignore * Refactor to use queries state instead of recordingRuleQueries * Refacrtor RecordingRuleEditor to use ds QueryEditor * Revert extra properties previously added to QueryEditor components * Remove console.log * Fix saving/editing a recording rule * Fix tests * Add margin to vizwrapper component
What is this feature?
Allows to preview queries when creating/editing Recording Rules.
Why do we need this feature?
Previously, it was only possible to do it for Alerting rules.
Who is this feature for?
All users.
Which issue(s) does this PR fix?:
Fixes #35699
Special notes for your reviewer: