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

Alerting plugin migrate to Kibana platform #57635

Conversation

YulNaumenko
Copy link
Contributor

@YulNaumenko YulNaumenko commented Feb 13, 2020

Summary

Migrates the Alerting plugin from Legacy on to the Kibana Platform.
Closes #51652

Checklist

Delete any items that are not applicable to this PR.

…rate-to-kibana-platform

# Conflicts:
#	.github/CODEOWNERS
#	x-pack/legacy/plugins/alerting/common/alert.ts
#	x-pack/legacy/plugins/alerting/common/types.ts
#	x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/update_prepacked_rules.ts
#	x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/update_rules.ts
#	x-pack/plugins/alerting/common/types.ts
#	x-pack/plugins/alerting/server/alerts_client.ts
#	x-pack/plugins/alerting/server/task_runner/alert_task_instance.ts
#	x-pack/plugins/alerting/server/types.ts
…rate-to-kibana-platform

# Conflicts:
#	x-pack/legacy/plugins/alerting/server/plugin.ts
@YulNaumenko YulNaumenko 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 13, 2020
@YulNaumenko YulNaumenko requested a review from a team as a code owner February 13, 2020 22:42
@YulNaumenko YulNaumenko self-assigned this Feb 13, 2020
@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@gmmorris gmmorris left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for sorting the git mv issue :)

x-pack/plugins/alerting/server/routes/create.ts Outdated Show resolved Hide resolved
x-pack/plugins/alerting/server/routes/find.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@mikecote mikecote left a comment

Choose a reason for hiding this comment

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

Change LGTM! Just one nit.

I would maybe hold off merging this until we merge #57524 (to avoid merge conflicts).

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, except for (I think) a missing if (!this.isInitialized) in alerts_client_factory.ts. Made some other nit-level comments.

Learned a bunch of new NP and TS tricks with this as well!

private readonly spaceIdToNamespace: SpaceIdToNamespaceFunction;
private readonly encryptedSavedObjectsPlugin: EncryptedSavedObjectsPluginStart;
private isInitialized = false;
private logger!: Logger;
Copy link
Member

Choose a reason for hiding this comment

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

Today I learned about using ! on properties like logger!! Wonder what @gmmorris thinks of that!? I'm happy with it for now, we seem to have multiple patterns to create plugin internal and exposed objects during setup/start, long-term perhaps we can settle on one.

const { securityPluginSetup } = this;
const spaceId = this.getSpaceId(legacyRequest);
const spaceId = this.getSpaceId(request);
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 we want a if (!this.isInitialized) throw new Error('not initialized') in here.

};
}

private createRouteHandlerContext = (): IContextProvider<
Copy link
Member

Choose a reason for hiding this comment

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

cool - hadn't seen a real use of this yet. I wonder if we could move more stuff in here over time, like the license check, but that's for another PR :-)

…igrate-to-kibana-platform

# Conflicts:
#	x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/__mocks__/_mock_server.ts
#	x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/get_existing_prepackaged_rules.test.ts
#	x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/get_export_all.test.ts
#	x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/get_export_by_object_ids.test.ts
#	x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/read_rules.test.ts
#	x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/types.ts
#	x-pack/legacy/plugins/siem/server/lib/detection_engine/signals/types.ts
#	x-pack/legacy/plugins/siem/server/lib/detection_engine/tags/read_tags.test.ts
…igrate-to-kibana-platform

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
…igrate-to-kibana-platform

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@YulNaumenko YulNaumenko merged commit c07ff71 into elastic:master Feb 18, 2020
YulNaumenko added a commit that referenced this pull request Feb 19, 2020
* resolved conflicts

* Delete codeowners file

* Revert merge conflicts with old version of utility.ts file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Alerting release_note:skip Skip the PR/issue when compiling release notes 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.

Migrate alerting plugin to New Platform
6 participants