RCA of terminate_after - #3
Open
RyanL1997 wants to merge 1 commit into
Open
Conversation
Signed-off-by: Jialiang Liang <jiallian@amazon.com>
RyanL1997
pushed a commit
that referenced
this pull request
Jul 16, 2026
…ch-project#12168) * feat: Add Create alert rule button to Metrics page Adds a 'Create alert rule' entry point at the top of the Metrics page that opens a flyout pre-populated with all current PromQL queries. Each query becomes a separate Cortex alerting rule with configurable threshold, operator, and for-duration. - Add CreateMetricsRuleFlyout component - Add button to metrics_page_tabs toolbar (visible in both Explore/Query tabs) - Read queries from QueryStringManager (no Update click required) - Support multi-query rule group creation via POST /api/alerting/prometheus/{dsId}/rules Signed-off-by: Riya Saxena <riysaxen@amazon.com> * fix: Fix deriveRuleName for wrapped PromQL and test timer handling - deriveRuleName now extracts inner metric name from function wrappers (e.g., rate(http_requests_total[5m]) -> http_requests_total) - Tests use fake timers to handle async save/poll/close flow - Add http.get mock for polling logic Signed-off-by: Riyaz Saxena <riysaxen@amazon.com> * test: Add dedicated unit tests for deriveRuleName regex patterns - Export deriveRuleName for direct testing - Add parameterized tests covering: function-wrapped metrics, simple metric names, label selectors, nested functions, and fallback Signed-off-by: Riyaz Saxena <riysaxen@amazon.com> * fix: Read selected metric from Explore tab for alert rule creation When on the Explore tab, parsedQueries now falls back to reading metricsExploreState.metric from Redux state, so the Create alert rule flyout pre-populates with the selected metric name instead of showing 'No queries to create rules from'. Signed-off-by: Riyaz Saxena <riysaxen@amazon.com> * test: Add Explore tab integration tests for flyout - Verify single metric from Explore tab renders one rule card - Verify plain metric name derives correct rule name Signed-off-by: Riyaz Saxena <riysaxen@amazon.com> * fix: Simplify flyout save states - show 'Creating in Prometheus...' throughout - Remove separate 'Confirming rule creation...' state from button - Show 'Creating in Prometheus...' for the entire save duration - Toast now says 'N alert rule(s) created successfully' (matches Rules tab UX) Signed-off-by: Riyaz Saxena <riysaxen@amazon.com> * fix: Pass addToast to flyout so success/error toasts are shown Wire services.notifications.toasts to the CreateMetricsRuleFlyout addToast prop so users see 'N alert rule(s) created successfully' toast on save, matching the Rules tab UX. Signed-off-by: Riyaz Saxena <riysaxen@amazon.com> * fix: Remove 90s polling from Metrics page flyout — close immediately on success Match the optimistic pattern from the Rules tab: POST rules, show success toast, close flyout immediately. Removed 'confirming' state, http.get prop (no longer needed for polling), and the 18x5s polling loop. Signed-off-by: Riyaz Saxena <riysaxen@amazon.com> * fix: Address lezzago + joshuali925 review comments - Deduplicate rule names to prevent Cortex group overwrites (lezzago) - Prevent flyout close during active save (lezzago) - Fix threshold input to allow decimals/negatives (joshuali925 #3) - Use splitMultiQueries helper instead of hand-rolled splitter (joshuali925 #2) - Remove 'as any' cast on http prop (joshuali925 #5) Signed-off-by: Riyaz Saxena <riysaxen@amazon.com> --------- Signed-off-by: Riya Saxena <riysaxen@amazon.com> Signed-off-by: Riyaz Saxena <riysaxen@amazon.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Issues Resolved
Screenshot
Testing the changes
Changelog
Check List
yarn test:jestyarn test:jest_integration