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

[RAC] Rename occurrences of alert_type to rule_type in Infra #120455

Merged
merged 3 commits into from
Dec 7, 2021

Conversation

ersin-erdal
Copy link
Contributor

@ersin-erdal ersin-erdal commented Dec 6, 2021

Fixes: #120375

According to terminology of Alerting Framework

Renamed
AlertInstance => Alert
AlertTypeParams => RuleTypeParams
AlertTypeState => RuleTypeState
AlertInstanceContext => AlertContext
AlertInstanceState => AlertState
AlertExecutorOptions => RuleExecutorOptions
registerAlertType => registerRuleType
evaluateAlert => evaluateRule

Probably RatioAlertParams, CountAlertParams, isRatioAlert, isRatioAlertParams etc. in alerting types should be renamed too but as this has already become a large PR, i'll tackle them in a different PR.

@ersin-erdal ersin-erdal added release_note:fix v8.0.0 auto-backport Deprecated - use backport:version if exact versions are needed Theme: rac label obsolete v8.1.0 Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" labels Dec 6, 2021
@ersin-erdal ersin-erdal marked this pull request as ready for review December 6, 2021 09:15
@ersin-erdal ersin-erdal requested a review from a team as a code owner December 6, 2021 09:15
@ersin-erdal ersin-erdal requested a review from a team December 6, 2021 09:16
@mgiota mgiota self-requested a review December 6, 2021 09:28
@Kerry350 Kerry350 self-requested a review December 6, 2021 10:24
Copy link
Contributor

@Kerry350 Kerry350 left a comment

Choose a reason for hiding this comment

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

The Infra changes look good 🎉

Just one question.

@@ -15,15 +15,15 @@ import {

import { ObservabilityRuleTypeModel } from '../../../../observability/public';

import { AlertTypeParams } from '../../../../alerting/common';
import { AlertTypeParams as RuleTypeParams } from '../../../../alerting/common';
Copy link
Contributor

Choose a reason for hiding this comment

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

And this is just until things change on the alerting side?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ys exactly. We also talked with them, they will use these names too, so we (or they) can just remove " .... as" part once they did the refactoring on their side.

// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { AlertTypeModel } from '../../../../triggers_actions_ui/public/types';
import { AlertTypeParams } from '../../../../alerting/common';
import { AlertTypeModel } from '../../../../triggers_actions_ui/public';
Copy link
Contributor

Choose a reason for hiding this comment

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

import { AlertTypeModel as RuleTypeModel } from '../../../../triggers_actions_ui/public';

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 am not sure if we should rename this now? Because we will refactor triggers_actions_ui too, then we can tackle these imports by searching by the usages.

InventoryMetricThresholdAllowedActionGroups
>(async ({ services, params }) => {
const { criteria, filterQuery, sourceId, nodeType, alertOnNoData } = params;
if (criteria.length === 0) throw new Error('Cannot execute an alert with 0 conditions');
const { alertWithLifecycle, savedObjectsClient } = services;
const alertInstanceFactory: InventoryMetricThresholdAlertInstanceFactory = (id, reason) =>
Copy link
Contributor

@mgiota mgiota Dec 6, 2021

Choose a reason for hiding this comment

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

The task_runner of the alerting framework exposes an alertInstanceFactory method https://github.com/elastic/kibana/blob/main/x-pack/plugins/alerting/server/task_runner/task_runner.ts#L321

This alertInstanceFactory variable is a local variable in this file, so I don't think we have a problem here. I make the comment just to double check if everything works as expected (I wait for yarn start to complete to double check)

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
infra 919 920 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
infra 990.9KB 990.8KB -4.0B

Page load bundle

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

id before after diff
infra 62.2KB 62.2KB -3.0B

History

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

@mgiota
Copy link
Contributor

mgiota commented Dec 6, 2021

@ersin-erdal Changes LGTM! I tested locally with Log threshlold and Inventory rule types and everything worked as expected.

@mgiota mgiota self-requested a review December 6, 2021 21:54
@ersin-erdal ersin-erdal merged commit 7aecfc9 into elastic:main Dec 7, 2021
@ersin-erdal ersin-erdal deleted the 120375-rename-alert-infra branch December 7, 2021 07:13
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Dec 7, 2021
…#120455)

[RAC] Rename occurrences of alert_type to rule_type in Infra
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
8.0

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Dec 7, 2021
#120573)

[RAC] Rename occurrences of alert_type to rule_type in Infra

Co-authored-by: Ersin Erdal <[email protected]>
jloleysens added a commit to jloleysens/kibana that referenced this pull request Dec 7, 2021
…-chromium-before-compiling-pdf

* 'main' of github.com:elastic/kibana: (121 commits)
  FTR should use the new kibana_system user (elastic#120436)
  [Lens] Temporarily exclude Mosaic/Waffle from the suggestions list (elastic#120488)
  [Reporting] Fix slow CSV with large max size bytes (elastic#120365)
  [CTI] Threat Intel Card on Overview page needs to accommodate Fleet TI integrations -  (elastic#120459)
  [Dashboard] Added KibanaThemeProvider.  (elastic#120122)
  add more rule_registry unit tests (elastic#120323)
  [Lens] update xpack.lens.pie.smallValuesWarningMessage text (elastic#120478)
  [Fleet] Simplified package policy create API, enriching default values (elastic#119739)
  mock `elastic-apm-node` in `@kbn/test` jest preset (elastic#120324)
  [RAC] Rename occurrences of alert_type to rule_type in Infra (elastic#120455)
  [Security Solutions] Removes tech debt of exporting all from linter rule for timeline plugin (elastic#120437)
  [Workplace Search] Add API Keys view to replace Access tokens (elastic#120147)
  [Security Solutions] Removes tech debt of exporting all from linter rule for cases plugin in the server section (elastic#120411)
  Add support for threat.feed.name (elastic#120250)
  [Rule Registry] Rewrite APM registry rules for Observability (elastic#117740)
  [docs] Fix artifact layout formatting (elastic#119386)
  [Workplace Search] Add a technical preview of connecting GitHub via GitHub apps (elastic#119764)
  add osquery notes for 7.16 (elastic#120407)
  chore(NA): splits types from code on @kbn/docs-utils (elastic#120533)
  [Reporting] Decouple screenshotting plugin from the reporting (elastic#120110)
  ...

# Conflicts:
#	x-pack/plugins/reporting/server/browsers/chromium/driver_factory/index.test.ts
#	x-pack/plugins/reporting/server/browsers/chromium/driver_factory/index.ts
#	x-pack/plugins/reporting/server/lib/screenshots/observable.test.ts
#	x-pack/plugins/reporting/server/lib/screenshots/observable.ts
#	x-pack/plugins/reporting/server/test_helpers/create_mock_browserdriverfactory.ts
@KOTungseth KOTungseth added the Team:APM All issues that need APM UI Team support label Dec 8, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:apm)

TinLe pushed a commit to TinLe/kibana that referenced this pull request Dec 22, 2021
…#120455)

[RAC] Rename occurrences of alert_type to rule_type in Infra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed release_note:fix Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" Team:APM All issues that need APM UI Team support Theme: rac label obsolete v8.0.0 v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RAC][INFRA] Rename occurrences of alert_type to rule_type in Infra
7 participants