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

Fix update alert API to still work when AAD is out of sync #57039

Merged
merged 5 commits into from
Feb 11, 2020

Conversation

mikecote
Copy link
Contributor

@mikecote mikecote commented Feb 6, 2020

Solves the update API for #56619.

In this PR, I'm allowing alerts to be updated when the AAD is out of sync. I'm also refactoring a bit the update unit tests of the alerts client.

@mikecote mikecote added Feature:Alerting v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.7.0 Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) labels Feb 6, 2020
@mikecote mikecote self-assigned this Feb 6, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-alerting-services (Team:Alerting Services)

@mikecote mikecote marked this pull request as ready for review February 6, 2020 20:51
@mikecote mikecote requested a review from a team as a code owner February 6, 2020 20:51
@mikecote mikecote added the review label Feb 6, 2020
@elasticmachine
Copy link
Contributor

💔 Build Failed

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

@elasticmachine
Copy link
Contributor

💔 Build Failed

History

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

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

History

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

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, left a comment on a Promise.all() call ...

}

const updateResult = await this.updateAlert({ id, data }, alertSavedObject);

await Promise.all([
Copy link
Member

Choose a reason for hiding this comment

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

I think technically, we don't really need a Promise.all() here. The old key should be invalidated, but no one should really be dependent on when that happens. Especially when it's paired with the TM runNow(). But this is really a nit. Worthy of perhaps a TODO comment to separate these - will require a bit of work to do error-checking on the invalidate key, and what to do when it fails? Not worth fixing ATM, I don't think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see your point, there's good and bad parts on both sides of doing an await here. My original thinking was that it facilitates tests knowing when the request is finished, all the underlying tasks are finished as well. This also facilitates controlling the flow in bulk if ever doing batches to avoid errors possibly caused by underlying tasks (ex: SIEM bulking requests for ~300 alerts).

On the other hand, it doesn't make sense slowing down the user and we have to add checks to make sure the error doesn't bubble up.

I'm happy to create an issue for this if we want to revisit this later?

Copy link
Member

Choose a reason for hiding this comment

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

Let's wait to see if it causes some kind of perf issue. We should see these show up in APM traces, we'll get a sense for if there is something we'll need to change.

@mikecote
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

Copy link
Contributor

@YulNaumenko YulNaumenko left a comment

Choose a reason for hiding this comment

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

LGTM

@mikecote mikecote merged commit 62e3189 into elastic:master Feb 11, 2020
mikecote added a commit to mikecote/kibana that referenced this pull request Feb 11, 2020
…7039)

* Ensure update API still works when AAD is broken

* Add API integration test

* Fix ESLint errors

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
mikecote added a commit that referenced this pull request Feb 11, 2020
…57305)

* Ensure update API still works when AAD is broken

* Add API integration test

* Fix ESLint errors

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
gmmorris added a commit to gmmorris/kibana that referenced this pull request Feb 11, 2020
* master: (27 commits)
  Include actions new platform plugin for codeowners (elastic#57252)
  [APM][docs] 7.6 documentation updates (elastic#57124)
  Expressions refactor (elastic#54342)
  [ML] New Platform server shim: update annotation routes to use new platform router  (elastic#57067)
  Remove injected ui app vars from Canvas (elastic#56190)
  update max_anomaly_score route schema to handle possible undefined values (elastic#57339)
  [Add panel flyout] Moving create new to the top of SavedObjectFinder (elastic#56428)
  Add mock of a legacy ui api to re-enable Canvas storybook (elastic#56673)
  [monitoring] Removes noisy event received log (elastic#57275)
  Remove use of copied MANAGEMENT_BREADCRUMBS and use `setBreadcrumbs` from management section's mount (elastic#57324)
  Advanced Settings management app to kibana platform plugin (elastic#56931)
  [ML] New Platform server shim: update recognize modules routes to use new platform router (elastic#57206)
  [ML] Fix overall stats for saved search on the Data Visualizer page (elastic#57312)
  [ML] [NP] Removing ui imports (elastic#56358)
  [SIEM] Fixes failing Cypress tests (elastic#57202)
  Create observability CODEOWNERS reference (elastic#57109)
  fix results service schema (elastic#57217)
  don't register a wrapper if browser side function exists. (elastic#57196)
  Ui Actions explorer example (elastic#57006)
  Fix update alert API to still work when AAD is out of sync (elastic#57039)
  ...
@mikecote mikecote removed the release_note:skip Skip the PR/issue when compiling release notes label Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Alerting release_note:fix review Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants