-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Pass termOrder and hasTermsAgg properties to serializeThresholdWatch function #54391
Pass termOrder and hasTermsAgg properties to serializeThresholdWatch function #54391
Conversation
…TermsAgg properties weren't being passed to the serializeThresholdWatch function.
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
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.
Code LGTM! I haven't tested locally.
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.
I tested locally and seems to work!
Well done for implementing this fix. Regarding this comment in the PR description:
I.e. the way the API is currently consumed precludes this getter from ever being called. So I
couldn't really test the effects my changes have upon this logic.
Is there some part of watcher that is not testable? Not sure I entirely follow.
@jloleysens Sorry about that! I'll try to clarify. There are three model classes on the server, representing different types of watches: The handler for the In our UI, the I assume that if we were to add simulate functionality to the threshold watch form, we would test that the endpoint works as expected when we send threshold watch data to it. |
…function (elastic#54391) * Fix Watcher regression in which a threshold watch's termOrder and hasTermsAgg properties weren't being passed to the serializeThresholdWatch function. * Remove unused upstreamJson getter method from server models.
…function (#54391) (#54484) * Fix Watcher regression in which a threshold watch's termOrder and hasTermsAgg properties weren't being passed to the serializeThresholdWatch function. * Remove unused upstreamJson getter method from server models. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@cjcenizal Thanks for the explanation! That makes sense! |
* master: (69 commits) [Graph] Fix various a11y issues (elastic#54097) Add ApplicationService app status management (elastic#50223) logs in one time (elastic#54447) Deprecate using `elasticsearch.ssl.certificate` without `elasticsearch.ssl.key` and vice versa (elastic#54392) [Optimizer] Fix a stack overflow with watch_cache when it attempts to delete very large folders. (elastic#54457) Security - Role Mappings UI (elastic#53620) [SIEM] [Detection engine] Permission II (elastic#54292) Allow User to Cleanup Repository from UI (elastic#53047) [Detection engine] Some UX for rule creation (elastic#54471) share specific instances of some ui packages (elastic#54079) [ML] APM modules configs for RUM Javascript and NodeJS (elastic#53792) [APM] Delay rendering invalid license notification (elastic#53924) [Graph] Improve error message on graph requests (elastic#54230) [ILM] Kibana should allow a min_age setting of 0ms in ILM policy phases (elastic#53719) Unit Tests for common/lib (elastic#53736) [Graph] Only show explorable fields (elastic#54101) remove linting rule exception for markdown (elastic#54232) [Monitoring] Fetch shard data more efficiently (elastic#54028) [Maps] Add hiddenLayers option to embeddable map input (elastic#54355) Pass termOrder and hasTermsAgg properties to serializeThresholdWatch function (elastic#54391) ...
* master: (69 commits) [Graph] Fix various a11y issues (elastic#54097) Add ApplicationService app status management (elastic#50223) logs in one time (elastic#54447) Deprecate using `elasticsearch.ssl.certificate` without `elasticsearch.ssl.key` and vice versa (elastic#54392) [Optimizer] Fix a stack overflow with watch_cache when it attempts to delete very large folders. (elastic#54457) Security - Role Mappings UI (elastic#53620) [SIEM] [Detection engine] Permission II (elastic#54292) Allow User to Cleanup Repository from UI (elastic#53047) [Detection engine] Some UX for rule creation (elastic#54471) share specific instances of some ui packages (elastic#54079) [ML] APM modules configs for RUM Javascript and NodeJS (elastic#53792) [APM] Delay rendering invalid license notification (elastic#53924) [Graph] Improve error message on graph requests (elastic#54230) [ILM] Kibana should allow a min_age setting of 0ms in ILM policy phases (elastic#53719) Unit Tests for common/lib (elastic#53736) [Graph] Only show explorable fields (elastic#54101) remove linting rule exception for markdown (elastic#54232) [Monitoring] Fetch shard data more efficiently (elastic#54028) [Maps] Add hiddenLayers option to embeddable map input (elastic#54355) Pass termOrder and hasTermsAgg properties to serializeThresholdWatch function (elastic#54391) ...
💔 Build FailedHistory
To update your PR or re-run it, just comment with: |
Release notes
A regression was introduced into 7.5.0 which caused a particular configuration of Threshold Watches to fail and/or erroneously trigger if they were created or edited in 7.5. If you've created or edited a Threshold Watch with a "GROUPED OVER" condition set to "top" with Kibana 7.5.0, you'll need to upgrade to a version of Kibana that contains this fix and recreate these watches. The easiest way to do this will be to go to the edit screen of the Threshold Watch in the UI and simply click the "Save" button. This will recreate the watch with the proper configuration. No other changes to the watch will be necessary on your part.
Description
Fixes #53974
This fixes a regression introduced in 7.5.0 via #43232, in which these arguments were not being provided. This resulted in two bugs, both of which would occur when when
GROUPED OVER
is set totop
, which sets atermField
and setshasTermsAgg
to true.Bug 1: Missing
termOrder
causes watch to failUnder this condition, build_input.js#L50 and build_input.js#L88 will consume
termOrder
in the presence of atermField
. IftermOrder
is undefined, thenorder
will be assigned an empty object, due to the wayJSON.stringify
strips out properties withundefined
values.Here's what this bug looks like in the request flyout:
Here's what the request flyout looks like now that the bug is fixed:
Bug 2: Missing
hasTermsAgg
results in incorrect condition scriptbuild_transform.js and build_condition.js both depend upon
hasTermsAgg
to specify the correct scripts. For example, in the screenshot below the condition script should be this and the transform script should be this.Here's what it looks like post-fix:
Due diligence
I untangled the logic on the server-side and found that the execute API consumes the
watchJson
getter that exists on all Watch models. The server-side ThresholdWatch model consumesserializeThresholdWatch
within its version of this getter. However, the execute API is only called by the UI when the user is viewing JSON watches. I.e. the way the API is currently consumed precludes this getter from ever being called. So I couldn't really test the effects my changes have upon this logic.Unrelated changes
In 27fcefa, I removed some unused model methods and verified this had no impact on creating, editing, simulating, or deleting watches.
Next steps
I plan to perform a tightly-scoped TS conversion to ensure that
serializeThresholdWatch
always receives the arguments it expects. This would have prevented this regression from originally being introduced. I'm going to do this in a separate PR because of the high level of effort required.