-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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: Fix Graphite subqueries #80744
Conversation
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.
This looks like a sensible approach to me! 🚀
@@ -136,6 +136,9 @@ export const QueryWrapper = ({ | |||
} | |||
|
|||
const showVizualisation = data.state !== LoadingState.NotStarted; | |||
// ⚠️ the query editors want the entire array of queries passed as "DataQuery" NOT "AlertQuery" | |||
// TypeScript isn't complaining here because the interfaces just happen to be compatible | |||
const editorQueries = cloneDeep(queries.map((query) => query.model)); |
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.
Leaving this here for posterity; some editors mutate the queries
prop they receive and those are managed by an immutable state and a reducer on the Alerting side – so we clone them before passing them forward.
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!
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
(cherry picked from commit 8a4bd85)
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-80744-to-v9.4.x origin/v9.4.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 8a4bd85efdd4101c481244b62d70e03e315d820c When the conflicts are resolved, stage and commit the changes:
If you have the GitHub CLI installed: # Push the branch to GitHub:
git push --set-upstream origin backport-80744-to-v9.4.x
# Create the PR body template
PR_BODY=$(gh pr view 80744 --json body --template 'Backport 8a4bd85efdd4101c481244b62d70e03e315d820c from #80744{{ "\n\n---\n\n" }}{{ index . "body" }}')
# Create the PR on GitHub
echo "${PR_BODY}" | gh pr create --title "[v9.4.x] Alerting: Fix Graphite subqueries" --body-file - --label "type/bug" --label "datasource/Graphite" --label "area/alerting" --label "area/frontend" --label "add to changelog" --label "backport" --base v9.4.x --milestone 9.4.x --web Or, if you don't have the GitHub CLI installed (we recommend you install it!): # Push the branch to GitHub:
git push --set-upstream origin backport-80744-to-v9.4.x
# Create a pull request where the `base` branch is `v9.4.x` and the `compare`/`head` branch is `backport-80744-to-v9.4.x`.
# Remove the local backport branch
git switch main
git branch -D backport-80744-to-v9.4.x |
(cherry picked from commit 8a4bd85)
What is this feature?
This PR contains 2 notable changes to make Graphite subqueries work within alerting.
AlertQuery
is compatible withDataQuery
(they both haverefId: string
) even though these are very different data structures.onChange
handler and writing the updates to its own state with a reducer. This PR adds thetargetFull
property to it so it can be recorded in the backend and used for rule evaluation.Special notes for your reviewer:
I wasn't quite sure about the changes made to the Graphite editor and currently am a bit perplexed about why this does work for the panel editor.
I'd love to get some feedback if I'm on the wrong track here and if we need a different approach.