Skip to content

Commit 6c27241

Browse files
[Alerting v2] Create an advanced setting to toggle the alerting v2 feature (elastic#272365)
## Summary This PR creates an advanced setting to toggle the alerting v2 feature. It controls the rule and dispatcher execution, the APIs, and the UIs. It does not control the resource creation. All resources will be created or registered regardless. Lastly, it removes all other advanced settings and consolidates the settings under one. I intentionally avoided any refactor on how other places in the code, like the agent builder, are being initialized based on the new setting to avoid getting out of scope. <img width="1912" height="217" alt="Screenshot 2026-06-03 at 1 05 02 PM" src="https://github.com/user-attachments/assets/9c33a3d9-e5f0-4137-b6e2-739070b5cde9" /> I also removed the tests in `x-pack/platform/test/api_integration_deployment_agnostic/alerting_v2` because they are already covered by Scout in the `alerting_v2` plugin and I migrated the telemetry test to Scout. Lastly, I created a `getAlertingV2ManagementNavPanel` util that is used by all solution navigations. This will help us in the future if we want to make changes to the way we show the alerting v2 navigation so as not to ping all teams for review. ## Test plan ### Manual verification #### 0. Preconditions - Local Kibana with the `alertingVTwo` plugin enabled. - Enable debug logging for the plugin so you can observe the rule executor / dispatcher halt logs. In `config/kibana.dev.yml`: ```yaml logging.loggers: - name: plugins.alertingVTwo level: debug ``` - Create **two V2 rules** so you cover both pipelines: - one of kind `signal` - one of kind `alerts` - Confirm `alerting:v2:enabled` is **on** in **Stack Management → Advanced Settings**. #### 1. Baseline — `alerting:v2:enabled = true` - **Stack Management nav:** the `V2 Alerting Preview` section is visible with its 4 apps: `Rules`, `Episodes`, `Action Policies`, `Execution History`. Each app opens normally. - **Rule executor logs:** rules run end-to-end. You should see normal step logs (no `engine_disabled` halt) and the rules produce alert events. - **Dispatcher logs:** dispatcher runs end-to-end (no `engine_disabled` halt) and dispatches actions. - **Agent Builder attachments:** if `agentBuilder` plugin is present, its attachments are still registered (no regression). #### 2. Kill switch — `alerting:v2:enabled = false` - Toggle `alerting:v2:enabled` to **off** in Advanced Settings, then **reload** the page (the setting is `requiresPageReload: true`). - **Stack Management nav:** - `V2 Alerting Preview` section is **gone**. - All 4 apps (`Rules`, `Episodes`, `Action Policies`, `Execution History`) are **gone**. - Direct URL navigation to any of those app paths results in core's "app not found" / not-rendered behavior. - **Rule executor logs** (per rule tick, for **each** of your two rules): ``` [check_engine_enabled] Alerting v2 is disabled, halting rule <rule_id> RuleExecutor: Pipeline halted at step: engine_disabled ``` - Confirm **no `RuleExecutor: Executing step: <name>` logs** appear for any step (this PR removes the misleading assembly-time log). - **Dispatcher logs:** ``` Dispatcher: Executing step: check_engine_enabled [check_engine_enabled] Alerting v2 is disabled, halting dispatcher execution <execution_uuid> Dispatcher: Pipeline halted at step: engine_disabled ``` - Confirm **no `Dispatcher: Executing step:` logs for any step after `check_engine_enabled`** — the dispatcher uses a sequential `for…of` loop, so a halt prevents subsequent step logs. - **No new alert events or action invocations** are produced while the setting is off. #### 3. Toggle back — `alerting:v2:enabled = true` - Toggle the setting back to **on**, reload the page. - **Stack Management nav:** `V2 Alerting Preview` section and all 4 apps reappear. - **Rule executor & dispatcher:** resume normal execution on the next tick (no Kibana restart required — the setting is read at execution time on the server). Fixes: elastic/rna-program#573 Fixes: elastic#262779 ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
1 parent 5b4e065 commit 6c27241

119 files changed

Lines changed: 1422 additions & 1252 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.buildkite/ftr-manifests/ftr_base_serverless_configs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ disabled:
1212
enabled:
1313
# Serverless deployment-agnostic configs to run platform api-integration tests
1414
- x-pack/platform/test/api_integration_deployment_agnostic/configs/serverless/oblt.serverless.config.ts
15-
- x-pack/platform/test/api_integration_deployment_agnostic/configs/serverless/oblt.alerting_v2.serverless.config.ts
1615
- x-pack/platform/test/api_integration_deployment_agnostic/configs/serverless/search.serverless.config.ts
1716
- x-pack/platform/test/api_integration_deployment_agnostic/configs/serverless/security.serverless.config.ts
1817
- x-pack/platform/test/api_integration_deployment_agnostic/configs/serverless/oblt.logs_essentials.serverless.config.ts

.buildkite/ftr-manifests/ftr_platform_stateful_configs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,5 +445,4 @@ enabled:
445445
- x-pack/platform/test/api_integration_deployment_agnostic/configs/stateful/platform.stateful.config.ts
446446
- x-pack/platform/test/api_integration_deployment_agnostic/configs/stateful/platform.streams_ccr.stateful.config.ts
447447
- x-pack/platform/test/api_integration/apis/streams/streams_without_security.config.ts
448-
- x-pack/platform/test/api_integration_deployment_agnostic/configs/stateful/platform.alerting_v2.stateful.config.ts
449448
- x-pack/platform/test/api_integration_deployment_agnostic/configs/stateful/platform.streams_definitions.feature_flag.stateful.config.ts

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,7 @@ x-pack/platform/packages/shared/response-ops/alerting-v2-constants @elastic/rna-
10951095
x-pack/platform/packages/shared/response-ops/alerting-v2-episodes-ui @elastic/rna-project-team
10961096
x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form @elastic/rna-project-team
10971097
x-pack/platform/packages/shared/response-ops/alerting-v2-schemas @elastic/rna-project-team
1098+
x-pack/platform/packages/shared/response-ops/alerting-v2-utils @elastic/response-ops
10981099
x-pack/platform/packages/shared/response-ops/alerts-apis @elastic/response-ops
10991100
x-pack/platform/packages/shared/response-ops/alerts-delete @elastic/response-ops
11001101
x-pack/platform/packages/shared/response-ops/alerts-fields-browser @elastic/response-ops

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@
226226
"@kbn/alerting-v2-plugin": "link:x-pack/platform/plugins/shared/alerting_v2",
227227
"@kbn/alerting-v2-rule-form": "link:x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form",
228228
"@kbn/alerting-v2-schemas": "link:x-pack/platform/packages/shared/response-ops/alerting-v2-schemas",
229+
"@kbn/alerting-v2-utils": "link:x-pack/platform/packages/shared/response-ops/alerting-v2-utils",
229230
"@kbn/alerts-as-data-utils": "link:src/platform/packages/shared/kbn-alerts-as-data-utils",
230231
"@kbn/alerts-grouping": "link:x-pack/solutions/observability/packages/kbn-alerts-grouping",
231232
"@kbn/alerts-restricted-fixtures-plugin": "link:x-pack/platform/test/alerting_api_integration/common/plugins/alerts_restricted",

src/platform/packages/shared/kbn-management/settings/utilities/category/const.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
export const GENERAL_CATEGORY = 'general';
1111
export const PRESENTATION_LAB_CATEGORY = 'Presentation Labs';
1212
export const ACCESSIBILITY_CATEGORY = 'accessibility';
13+
export const ALERTING_V2_CATEGORY = 'alertingV2';
1314
export const AUTOCOMPLETE_CATEGORY = 'autocomplete';
1415
export const BANNER_CATEGORY = 'banner';
1516
export const DISCOVER_CATEGORY = 'discover';
@@ -29,6 +30,7 @@ export const CATEGORY_ORDER = [
2930
GENERAL_CATEGORY,
3031
PRESENTATION_LAB_CATEGORY,
3132
ACCESSIBILITY_CATEGORY,
33+
ALERTING_V2_CATEGORY,
3234
AUTOCOMPLETE_CATEGORY,
3335
BANNER_CATEGORY,
3436
DISCOVER_CATEGORY,

src/platform/packages/shared/kbn-management/settings/utilities/category/get_category_name.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import { i18n } from '@kbn/i18n';
1111
import {
1212
ACCESSIBILITY_CATEGORY,
13+
ALERTING_V2_CATEGORY,
1314
AUTOCOMPLETE_CATEGORY,
1415
BANNER_CATEGORY,
1516
DEV_TOOLS_CATEGORY,
@@ -97,6 +98,9 @@ const names: Record<string, string> = {
9798
[DEV_TOOLS_CATEGORY]: i18n.translate('management.settings.categoryNames.devToolsLabel', {
9899
defaultMessage: 'Developer Tools',
99100
}),
101+
[ALERTING_V2_CATEGORY]: i18n.translate('management.settings.categoryNames.alertingV2Label', {
102+
defaultMessage: 'Alerting V2',
103+
}),
100104
};
101105

102106
export function getCategoryName(category?: string) {

src/platform/packages/shared/kbn-scout/src/servers/configs/config_sets/alerting_v2/serverless/observability_complete.serverless.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const servers: ScoutServerConfig = {
1717
serverArgs: [
1818
...defaultConfig.kbnTestServer.serverArgs,
1919
'--xpack.alerting_v2.enabled=true',
20+
'--uiSettings.globalOverrides.alerting:v2:enabled=true',
2021
'--migrations.allowWipTypes=["alerting_action_policy","alerting_api_key_pending_invalidation","alerting_rule"]',
2122
],
2223
},

src/platform/packages/shared/kbn-scout/src/servers/configs/config_sets/alerting_v2/serverless/search.serverless.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const servers: ScoutServerConfig = {
1717
serverArgs: [
1818
...defaultConfig.kbnTestServer.serverArgs,
1919
'--xpack.alerting_v2.enabled=true',
20+
'--uiSettings.globalOverrides.alerting:v2:enabled=true',
2021
'--migrations.allowWipTypes=["alerting_action_policy","alerting_api_key_pending_invalidation","alerting_rule"]',
2122
],
2223
},

src/platform/packages/shared/kbn-scout/src/servers/configs/config_sets/alerting_v2/serverless/security_complete.serverless.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const servers: ScoutServerConfig = {
1717
serverArgs: [
1818
...defaultConfig.kbnTestServer.serverArgs,
1919
'--xpack.alerting_v2.enabled=true',
20+
'--uiSettings.globalOverrides.alerting:v2:enabled=true',
2021
'--migrations.allowWipTypes=["alerting_action_policy","alerting_api_key_pending_invalidation","alerting_rule"]',
2122
],
2223
},

src/platform/packages/shared/kbn-scout/src/servers/configs/config_sets/alerting_v2/stateful/classic.stateful.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const servers: ScoutServerConfig = {
1717
serverArgs: [
1818
...defaultConfig.kbnTestServer.serverArgs,
1919
'--xpack.alerting_v2.enabled=true',
20+
'--uiSettings.globalOverrides.alerting:v2:enabled=true',
2021
'--migrations.allowWipTypes=["alerting_action_policy","alerting_api_key_pending_invalidation","alerting_rule"]',
2122
],
2223
},

0 commit comments

Comments
 (0)