From b280d71a9d8a6398dd4cb3285fcb02889a43f7b5 Mon Sep 17 00:00:00 2001 From: lcawl Date: Wed, 13 Nov 2024 18:00:08 -0800 Subject: [PATCH 1/2] [OpenAPI][DOCS] Add descriptions for flapping rule settings --- oas_docs/bundle.json | 18 ++++++++++++++++++ oas_docs/bundle.serverless.json | 18 ++++++++++++++++++ .../routes/rule/common/flapping/schemas/v1.ts | 13 ++++++++++++- 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/oas_docs/bundle.json b/oas_docs/bundle.json index aa53ce68e54fd..585edf50f42a5 100644 --- a/oas_docs/bundle.json +++ b/oas_docs/bundle.json @@ -1304,14 +1304,17 @@ }, "flapping": { "additionalProperties": false, + "description": "When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced.", "nullable": true, "properties": { "look_back_window": { + "description": "The minimum number of runs in which the threshold must be met.", "maximum": 20, "minimum": 2, "type": "number" }, "status_change_threshold": { + "description": "The minimum number of times an alert must switch states in the look back window.", "maximum": 20, "minimum": 2, "type": "number" @@ -2083,14 +2086,17 @@ }, "flapping": { "additionalProperties": false, + "description": "When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced.", "nullable": true, "properties": { "look_back_window": { + "description": "The minimum number of runs in which the threshold must be met.", "maximum": 20, "minimum": 2, "type": "number" }, "status_change_threshold": { + "description": "The minimum number of times an alert must switch states in the look back window.", "maximum": 20, "minimum": 2, "type": "number" @@ -2484,14 +2490,17 @@ }, "flapping": { "additionalProperties": false, + "description": "When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced.", "nullable": true, "properties": { "look_back_window": { + "description": "The minimum number of runs in which the threshold must be met.", "maximum": 20, "minimum": 2, "type": "number" }, "status_change_threshold": { + "description": "The minimum number of times an alert must switch states in the look back window.", "maximum": 20, "minimum": 2, "type": "number" @@ -3253,14 +3262,17 @@ }, "flapping": { "additionalProperties": false, + "description": "When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced.", "nullable": true, "properties": { "look_back_window": { + "description": "The minimum number of runs in which the threshold must be met.", "maximum": 20, "minimum": 2, "type": "number" }, "status_change_threshold": { + "description": "The minimum number of times an alert must switch states in the look back window.", "maximum": 20, "minimum": 2, "type": "number" @@ -3647,14 +3659,17 @@ }, "flapping": { "additionalProperties": false, + "description": "When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced.", "nullable": true, "properties": { "look_back_window": { + "description": "The minimum number of runs in which the threshold must be met.", "maximum": 20, "minimum": 2, "type": "number" }, "status_change_threshold": { + "description": "The minimum number of times an alert must switch states in the look back window.", "maximum": 20, "minimum": 2, "type": "number" @@ -5094,14 +5109,17 @@ }, "flapping": { "additionalProperties": false, + "description": "When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced.", "nullable": true, "properties": { "look_back_window": { + "description": "The minimum number of runs in which the threshold must be met.", "maximum": 20, "minimum": 2, "type": "number" }, "status_change_threshold": { + "description": "The minimum number of times an alert must switch states in the look back window.", "maximum": 20, "minimum": 2, "type": "number" diff --git a/oas_docs/bundle.serverless.json b/oas_docs/bundle.serverless.json index 1267027a3687a..362059adcff8c 100644 --- a/oas_docs/bundle.serverless.json +++ b/oas_docs/bundle.serverless.json @@ -1304,14 +1304,17 @@ }, "flapping": { "additionalProperties": false, + "description": "When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced.", "nullable": true, "properties": { "look_back_window": { + "description": "The minimum number of runs in which the threshold must be met.", "maximum": 20, "minimum": 2, "type": "number" }, "status_change_threshold": { + "description": "The minimum number of times an alert must switch states in the look back window.", "maximum": 20, "minimum": 2, "type": "number" @@ -2083,14 +2086,17 @@ }, "flapping": { "additionalProperties": false, + "description": "When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced.", "nullable": true, "properties": { "look_back_window": { + "description": "The minimum number of runs in which the threshold must be met.", "maximum": 20, "minimum": 2, "type": "number" }, "status_change_threshold": { + "description": "The minimum number of times an alert must switch states in the look back window.", "maximum": 20, "minimum": 2, "type": "number" @@ -2484,14 +2490,17 @@ }, "flapping": { "additionalProperties": false, + "description": "When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced.", "nullable": true, "properties": { "look_back_window": { + "description": "The minimum number of runs in which the threshold must be met.", "maximum": 20, "minimum": 2, "type": "number" }, "status_change_threshold": { + "description": "The minimum number of times an alert must switch states in the look back window.", "maximum": 20, "minimum": 2, "type": "number" @@ -3253,14 +3262,17 @@ }, "flapping": { "additionalProperties": false, + "description": "When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced.", "nullable": true, "properties": { "look_back_window": { + "description": "The minimum number of runs in which the threshold must be met.", "maximum": 20, "minimum": 2, "type": "number" }, "status_change_threshold": { + "description": "The minimum number of times an alert must switch states in the look back window.", "maximum": 20, "minimum": 2, "type": "number" @@ -3647,14 +3659,17 @@ }, "flapping": { "additionalProperties": false, + "description": "When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced.", "nullable": true, "properties": { "look_back_window": { + "description": "The minimum number of runs in which the threshold must be met.", "maximum": 20, "minimum": 2, "type": "number" }, "status_change_threshold": { + "description": "The minimum number of times an alert must switch states in the look back window.", "maximum": 20, "minimum": 2, "type": "number" @@ -5094,14 +5109,17 @@ }, "flapping": { "additionalProperties": false, + "description": "When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced.", "nullable": true, "properties": { "look_back_window": { + "description": "The minimum number of runs in which the threshold must be met.", "maximum": 20, "minimum": 2, "type": "number" }, "status_change_threshold": { + "description": "The minimum number of times an alert must switch states in the look back window.", "maximum": 20, "minimum": 2, "type": "number" diff --git a/x-pack/plugins/alerting/common/routes/rule/common/flapping/schemas/v1.ts b/x-pack/plugins/alerting/common/routes/rule/common/flapping/schemas/v1.ts index 4844a9e808ef5..acdd35854df3f 100644 --- a/x-pack/plugins/alerting/common/routes/rule/common/flapping/schemas/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/common/flapping/schemas/v1.ts @@ -17,13 +17,24 @@ import { validateFlapping as validateFlappingV1 } from '../../../validation/vali export const flappingSchema = schema.object( { look_back_window: schema.number({ + meta: { description: 'The minimum number of runs in which the threshold must be met.' }, min: MIN_LOOK_BACK_WINDOW_V1, max: MAX_LOOK_BACK_WINDOW_V1, }), status_change_threshold: schema.number({ + meta: { + description: + 'The minimum number of times an alert must switch states in the look back window.', + }, min: MIN_STATUS_CHANGE_THRESHOLD_V1, max: MAX_STATUS_CHANGE_THRESHOLD_V1, }), }, - { validate: validateFlappingV1 } + { + validate: validateFlappingV1, + meta: { + description: + 'When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced.', + }, + } ); From b370316fa92a9c96e1021aa0a39541c1c935c984 Mon Sep 17 00:00:00 2001 From: lcawl Date: Wed, 13 Nov 2024 18:00:58 -0800 Subject: [PATCH 2/2] Generate OpenAPI output --- oas_docs/output/kibana.serverless.yaml | 60 ++++++++++++++++++++++++++ oas_docs/output/kibana.yaml | 60 ++++++++++++++++++++++++++ 2 files changed, 120 insertions(+) diff --git a/oas_docs/output/kibana.serverless.yaml b/oas_docs/output/kibana.serverless.yaml index 2b64330a1937a..696529adf239f 100644 --- a/oas_docs/output/kibana.serverless.yaml +++ b/oas_docs/output/kibana.serverless.yaml @@ -868,14 +868,24 @@ paths: - last_execution_date flapping: additionalProperties: false + description: >- + When flapping detection is turned on, alerts that switch + quickly between active and recovered states are identified + as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: + description: >- + The minimum number of runs in which the threshold must + be met. maximum: 20 minimum: 2 type: number status_change_threshold: + description: >- + The minimum number of times an alert must switch + states in the look back window. maximum: 20 minimum: 2 type: number @@ -1591,14 +1601,24 @@ paths: type: boolean flapping: additionalProperties: false + description: >- + When flapping detection is turned on, alerts that switch + quickly between active and recovered states are identified + as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: + description: >- + The minimum number of runs in which the threshold must + be met. maximum: 20 minimum: 2 type: number status_change_threshold: + description: >- + The minimum number of times an alert must switch states + in the look back window. maximum: 20 minimum: 2 type: number @@ -1991,14 +2011,24 @@ paths: - last_execution_date flapping: additionalProperties: false + description: >- + When flapping detection is turned on, alerts that switch + quickly between active and recovered states are identified + as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: + description: >- + The minimum number of runs in which the threshold must + be met. maximum: 20 minimum: 2 type: number status_change_threshold: + description: >- + The minimum number of times an alert must switch + states in the look back window. maximum: 20 minimum: 2 type: number @@ -2693,14 +2723,24 @@ paths: - active flapping: additionalProperties: false + description: >- + When flapping detection is turned on, alerts that switch + quickly between active and recovered states are identified + as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: + description: >- + The minimum number of runs in which the threshold must + be met. maximum: 20 minimum: 2 type: number status_change_threshold: + description: >- + The minimum number of times an alert must switch states + in the look back window. maximum: 20 minimum: 2 type: number @@ -3085,14 +3125,24 @@ paths: - last_execution_date flapping: additionalProperties: false + description: >- + When flapping detection is turned on, alerts that switch + quickly between active and recovered states are identified + as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: + description: >- + The minimum number of runs in which the threshold must + be met. maximum: 20 minimum: 2 type: number status_change_threshold: + description: >- + The minimum number of times an alert must switch + states in the look back window. maximum: 20 minimum: 2 type: number @@ -4271,14 +4321,24 @@ paths: - last_execution_date flapping: additionalProperties: false + description: >- + When flapping detection is turned on, alerts that switch + quickly between active and recovered states are identified + as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: + description: >- + The minimum number of runs in which the threshold must + be met. maximum: 20 minimum: 2 type: number status_change_threshold: + description: >- + The minimum number of times an alert must switch + states in the look back window. maximum: 20 minimum: 2 type: number diff --git a/oas_docs/output/kibana.yaml b/oas_docs/output/kibana.yaml index db3282f2c7899..9ede8eb3c088b 100644 --- a/oas_docs/output/kibana.yaml +++ b/oas_docs/output/kibana.yaml @@ -1253,14 +1253,24 @@ paths: - last_execution_date flapping: additionalProperties: false + description: >- + When flapping detection is turned on, alerts that switch + quickly between active and recovered states are identified + as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: + description: >- + The minimum number of runs in which the threshold must + be met. maximum: 20 minimum: 2 type: number status_change_threshold: + description: >- + The minimum number of times an alert must switch + states in the look back window. maximum: 20 minimum: 2 type: number @@ -1976,14 +1986,24 @@ paths: type: boolean flapping: additionalProperties: false + description: >- + When flapping detection is turned on, alerts that switch + quickly between active and recovered states are identified + as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: + description: >- + The minimum number of runs in which the threshold must + be met. maximum: 20 minimum: 2 type: number status_change_threshold: + description: >- + The minimum number of times an alert must switch states + in the look back window. maximum: 20 minimum: 2 type: number @@ -2376,14 +2396,24 @@ paths: - last_execution_date flapping: additionalProperties: false + description: >- + When flapping detection is turned on, alerts that switch + quickly between active and recovered states are identified + as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: + description: >- + The minimum number of runs in which the threshold must + be met. maximum: 20 minimum: 2 type: number status_change_threshold: + description: >- + The minimum number of times an alert must switch + states in the look back window. maximum: 20 minimum: 2 type: number @@ -3078,14 +3108,24 @@ paths: - active flapping: additionalProperties: false + description: >- + When flapping detection is turned on, alerts that switch + quickly between active and recovered states are identified + as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: + description: >- + The minimum number of runs in which the threshold must + be met. maximum: 20 minimum: 2 type: number status_change_threshold: + description: >- + The minimum number of times an alert must switch states + in the look back window. maximum: 20 minimum: 2 type: number @@ -3470,14 +3510,24 @@ paths: - last_execution_date flapping: additionalProperties: false + description: >- + When flapping detection is turned on, alerts that switch + quickly between active and recovered states are identified + as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: + description: >- + The minimum number of runs in which the threshold must + be met. maximum: 20 minimum: 2 type: number status_change_threshold: + description: >- + The minimum number of times an alert must switch + states in the look back window. maximum: 20 minimum: 2 type: number @@ -4656,14 +4706,24 @@ paths: - last_execution_date flapping: additionalProperties: false + description: >- + When flapping detection is turned on, alerts that switch + quickly between active and recovered states are identified + as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: + description: >- + The minimum number of runs in which the threshold must + be met. maximum: 20 minimum: 2 type: number status_change_threshold: + description: >- + The minimum number of times an alert must switch + states in the look back window. maximum: 20 minimum: 2 type: number