Skip to content
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

[Response Ops][Alerting] Fixing bug with agg building for ES query rule when there are multi-terms and a group by field #182865

Merged
merged 4 commits into from
May 8, 2024

Conversation

ymao1
Copy link
Contributor

@ymao1 ymao1 commented May 7, 2024

Towards #182755

Summary

Aggregation builder was updated to accommodate multiple term fields but the group-by portion of the builder does not properly handle multi-term aggs.

@@ -793,6 +793,51 @@ describe('buildAgg', () => {
});
});

it('should create correct aggregation when condition params are defined and multi terms selected', async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you remove the fix and run this test, you'll see the same TypeError: Cannot set properties of undefined (setting 'order') error that we see in the logs

@ymao1 ymao1 self-assigned this May 7, 2024
@ymao1 ymao1 added Feature:Alerting Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.14.0 v8.15.0 release_note:fix labels May 7, 2024
@ymao1 ymao1 marked this pull request as ready for review May 7, 2024 18:56
@ymao1 ymao1 requested a review from a team as a code owner May 7, 2024 18:56
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

Copy link
Member

@pmuellr pmuellr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I noticed that aggParent is an any - and I checked and can't use any in an alerting plugin server plugin. So, wondering a couple things:

  • should we disallow any in general for the TA_UI code?
  • as a simpler exercise, could we do typing on the aggParent itself?

Not sure it's worth the effort ...

@ymao1
Copy link
Contributor Author

ymao1 commented May 8, 2024

@pmuellr I added an ES type in this commit: 8476e3d

The ES type is a little weird because aggs is optional, but I didn't want to make up my own type. WDYT.

should we disallow any in general for the TA_UI code?

I can make a followup issue for this. ETA: followup issue: #182895

@pmuellr
Copy link
Member

pmuellr commented May 8, 2024

The ES type is a little weird because aggs is optional, but I didn't want to make up my own type. WDYT.

meh, it's no weirder than other ES types :-)

LGTM. I should have been more specific that I was thinking about this as a followup. Thanks for the extra effort!

And thanks for the followup issue on the use of any in general!

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
triggersActionsUi 120.9KB 121.2KB +230.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @ymao1

@ymao1 ymao1 merged commit 3f7731c into elastic:main May 8, 2024
18 checks passed
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request May 8, 2024
…le when there are multi-terms and a group by field (elastic#182865)

(cherry picked from commit 3f7731c)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.14

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request May 8, 2024
…uery rule when there are multi-terms and a group by field (#182865) (#182898)

# Backport

This will backport the following commits from `main` to `8.14`:
- [[Response Ops][Alerting] Fixing bug with agg building for ES query
rule when there are multi-terms and a group by field
(#182865)](#182865)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Ying
Mao","email":"ying.mao@elastic.co"},"sourceCommit":{"committedDate":"2024-05-08T02:58:19Z","message":"[Response
Ops][Alerting] Fixing bug with agg building for ES query rule when there
are multi-terms and a group by field
(#182865)","sha":"3f7731c8b79dc349111a843e39247f11b946b228","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:Alerting","Team:ResponseOps","v8.14.0","v8.15.0"],"title":"[Response
Ops][Alerting] Fixing bug with agg building for ES query rule when there
are multi-terms and a group by
field","number":182865,"url":"#182865
Ops][Alerting] Fixing bug with agg building for ES query rule when there
are multi-terms and a group by field
(#182865)","sha":"3f7731c8b79dc349111a843e39247f11b946b228"}},"sourceBranch":"main","suggestedTargetBranches":["8.14"],"targetPullRequestStates":[{"branch":"8.14","label":"v8.14.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.15.0","branchLabelMappingKey":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"#182865
Ops][Alerting] Fixing bug with agg building for ES query rule when there
are multi-terms and a group by field
(#182865)","sha":"3f7731c8b79dc349111a843e39247f11b946b228"}}]}]
BACKPORT-->

Co-authored-by: Ying Mao <ying.mao@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Alerting release_note:fix Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.14.0 v8.15.0
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants