Skip to content

Commit

Permalink
Merge branch 'main' into fix-today
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 authored Jan 10, 2023
2 parents c0b98ac + 72bd23b commit d3afb68
Show file tree
Hide file tree
Showing 44 changed files with 2,266 additions and 673 deletions.
408 changes: 343 additions & 65 deletions docs/api-generated/rules/rule-apis-passthru.asciidoc

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion docs/api/alerting/delete_rule.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ Permanently removes a rule.

WARNING: After you delete a rule, you cannot recover it.

[NOTE]
====
For the most up-to-date API details, refer to the
{kib-repo}/tree/{branch}/x-pack/plugins/alerting/docs/openapi[open API specification]. For a preview, check out <<rule-apis>>.
====

[[delete-rule-api-request]]
=== {api-request-title}

Expand Down Expand Up @@ -36,7 +42,7 @@ default space is used.
[[delete-rule-api-response-codes]]
=== {api-response-codes-title}

`200`::
`204`::
Indicates a successful call.

=== {api-examples-title}
Expand Down
88 changes: 62 additions & 26 deletions docs/api/alerting/get_rules.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

Retrieve a rule by ID.

[NOTE]
====
For the most up-to-date API details, refer to the
{kib-repo}/tree/{branch}/x-pack/plugins/alerting/docs/openapi[open API specification]. For a preview, check out <<rule-apis>>.
====

[[get-rule-api-request]]
=== {api-request-title}

Expand Down Expand Up @@ -55,33 +61,63 @@ The API returns the following:
[source,sh]
--------------------------------------------------
{
"id": "0a037d60-6b62-11eb-9e0d-85d233e3ee35",
"notify_when": "onActionGroupChange",
"params": {
"aggType": "avg",
"id":"31697a40-7b36-11ed-aa79-f742c05329b2",
"consumer":"alerts",
"tags":["cpu"],
"name":"my alert",
"enabled":true,
"throttle":null,
"schedule":{
"interval":"1m"
},
"params":{
"aggType":"avg",
"termSize":6,
"thresholdComparator":">",
"timeWindowSize":5,
"timeWindowUnit":"m",
"groupBy":"top",
"threshold":[1000],
"index":["test-index"],
"timeField":"@timestamp",
"aggField":"sheet.version",
"termField":"name.keyword"
},
"rule_type_id":".index-threshold",
"created_by":"elastic",
"updated_by":"elastic",
"created_at":"2022-12-13T22:33:41.163Z",
"updated_at":"2022-12-13T22:33:41.163Z",
"api_key_owner":"elastic",
"notify_when":"onActionGroupChange",
"muted_alert_ids":[],
"mute_all":false,
"scheduled_task_id":"31697a40-7b36-11ed-aa79-f742c05329b2",
"execution_status":{
"status":"ok",
"last_execution_date":"2022-12-13T22:33:44.388Z",
"last_duration":83
},
"consumer": "alerts",
"rule_type_id": "test.rule.type",
"schedule": {
"interval": "1m"
"actions":[{
"group":"threshold met",
"id":"1007a0c0-7a6e-11ed-89d5-abec321c0def",
"params":{
"level":"info",
"message":"alert {{alertName}} is active for group {{context.group}}:\n\n- Value: {{context.value}}\n- Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}}\n- Timestamp: {{context.date}}"
},
"connector_type_id":".server-log"
}],
"last_run":{
"alerts_count":{
"new":0,
"ignored":0,
"recovered":0,
"active":0
},
"outcome_msg":null,
"warning":null,
"outcome":"succeeded"
},
"actions": [],
"tags": [],
"name": "test rule",
"enabled": true,
"throttle": null,
"api_key_owner": "elastic",
"created_by": "elastic",
"updated_by": "elastic",
"mute_all": false,
"muted_alert_ids": [],
"updated_at": "2021-02-10T05:37:19.086Z",
"created_at": "2021-02-10T05:37:19.086Z",
"scheduled_task_id": "0b092d90-6b62-11eb-9e0d-85d233e3ee35",
"execution_status": {
"last_execution_date": "2021-02-10T17:55:14.262Z",
"status": "ok",
"last_duration": 359
}
"next_run":"2022-12-13T22:34:44.314Z"
}
--------------------------------------------------
29 changes: 23 additions & 6 deletions docs/api/alerting/update_rule.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

Update the attributes for an existing rule.

[NOTE]
====
For the most up-to-date API details, refer to the
{kib-repo}/tree/{branch}/x-pack/plugins/alerting/docs/openapi[open API specification]. For a preview, check out <<rule-apis>>.
====

[[update-rule-api-request]]
=== {api-request-title}

Expand Down Expand Up @@ -132,7 +138,6 @@ PUT api/alerting/rule/ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74
"timeWindowUnit":"m",
"thresholdComparator":">",
"threshold":[1000],
"aggType":"avg",
"aggField":"sheet.version",
"termField":"name.keyword",
"termSize":6
Expand Down Expand Up @@ -180,16 +185,28 @@ The API returns the following:
"updated_by": "elastic",
"rule_type_id": ".index-threshold",
"scheduled_task_id": "4c5eda00-e74f-11ec-b72f-5b18752ff9ea",
"created_at": "2022-06-08T17:20:31.632Z",
"updated_at": "2022-06-09T23:36:36.090Z",
"created_at": "2022-12-12T22:43:20.578Z",
"updated_at": "2022-12-12T22:44:21.783Z",
"notify_when": "onActionGroupChange",
"mute_all": false,
"muted_alert_ids": [],
"execution_status": {
"status": "ok",
"last_execution_date": "2022-06-09T23:36:17.332Z",
"last_duration": 577
"last_execution_date": "2022-12-12T22:43:21.723Z",
"last_duration": 125
},
"actions":[],
"last_run":{
"alerts_count": {
"new": 0,
"ignored": 0,
"recovered": 0,
"active": 0
},
"outcome_msg" :null,
"warning": null,
"outcome": "succeeded"
},
"actions":[]
"next_run": "2022-12-12T22:44:21.653Z"
}
--------------------------------------------------
54 changes: 29 additions & 25 deletions packages/kbn-sort-package-json/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,33 @@ import sorter from 'sort-package-json';
* @returns
*/
export function sortPackageJson(json) {
return sorter(typeof json === 'string' ? json : JSON.stringify(json, null, 2), {
// top level keys in the order they were written when this was implemented
sortOrder: [
'name',
'description',
'keywords',
'private',
'version',
'branch',
'main',
'browser',
'types',
'tsdocMetadata',
'build',
'homepage',
'bugs',
'license',
'kibana',
'author',
'scripts',
'repository',
'engines',
'resolutions',
],
});
return sorter(
// always parse and stringify the json to make sure it's using 2 space indentation
JSON.stringify(typeof json === 'string' ? JSON.parse(json) : json, null, 2),
{
// top level keys in the order they were written when this was implemented
sortOrder: [
'name',
'description',
'keywords',
'private',
'version',
'branch',
'main',
'browser',
'types',
'tsdocMetadata',
'build',
'homepage',
'bugs',
'license',
'kibana',
'author',
'scripts',
'repository',
'engines',
'resolutions',
],
}
);
}
Loading

0 comments on commit d3afb68

Please sign in to comment.