Skip to content

Commit

Permalink
Merge branch '8.5' into backport/8.5/pr-141239
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Sep 22, 2022
2 parents 6d6616b + ca0c5ef commit 4e90ce6
Show file tree
Hide file tree
Showing 70 changed files with 950 additions and 1,600 deletions.
8 changes: 4 additions & 4 deletions docs/api/alerting.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ include::alerting/health.asciidoc[leveloffset=+1]
include::alerting/get_rules.asciidoc[leveloffset=+1]
include::alerting/list_rule_types.asciidoc[leveloffset=+1]
include::alerting/update_rule.asciidoc[leveloffset=+1]
include::alerting/mute_all_alerts.asciidoc[]
include::alerting/mute_alert.asciidoc[]
include::alerting/unmute_all_alerts.asciidoc[]
include::alerting/unmute_alert.asciidoc[]
include::alerting/mute_all_alerts.asciidoc[leveloffset=+1]
include::alerting/mute_alert.asciidoc[leveloffset=+1]
include::alerting/unmute_all_alerts.asciidoc[leveloffset=+1]
include::alerting/unmute_alert.asciidoc[leveloffset=+1]
include::alerting/legacy/index.asciidoc[]
30 changes: 19 additions & 11 deletions docs/api/alerting/mute_alert.asciidoc
Original file line number Diff line number Diff line change
@@ -1,42 +1,50 @@
[[mute-alert-api]]
=== Mute alert API
== Mute alert API
++++
<titleabbrev>Mute alert</titleabbrev>
++++

Mute an alert.

[[mute-alert-api-request]]
==== Request
=== {api-request-title}

`POST <kibana host>:<port>/api/alerting/rule/<rule_id>/alert/<alert_id>/_mute`

`POST <kibana host>:<port>/s/<space_id>/api/alerting/rule/<rule_id>/alert/<alert_id>/_mute`

[[mute-alert-api-path-params]]
==== Path parameters
=== {api-prereq-title}

`rule_id`::
(Required, string) The ID of the rule whose alert you want to mute.
You must have `all` privileges for the appropriate {kib} features, depending on
the `consumer` and `rule_type_id` of the rules you're creating. For example, the
*Management* > *Stack Rules* feature, *Analytics* > *Discover* and *{ml-app}*
features, *{observability}*, and *Security* features. If the rule has `actions`,
you must also have `read` privileges for the *Management* >
*Actions and Connectors* feature. For more details, refer to
<<kibana-feature-privileges>>.

[[mute-alert-api-path-params]]
=== {api-path-parms-title}

`alert_id`::
(Required, string) The ID of the alert that you want to mute. The `alert_id` is generated by the rule and might be any arbitrary string.

`rule_id`::
(Required, string) The ID of the rule whose alert you want to mute.

`space_id`::
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.

[[mute-alert-api-response-codes]]
==== Response code
=== {api-response-codes-title}

`200`::
Indicates a successful call.

==== Example

Mute alert with ID:
=== {api-examples-title}

[source,sh]
--------------------------------------------------
$ curl -X POST api/alerting/rule/41893910-6bca-11eb-9e0d-85d233e3ee35/alert/dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2/_mute
POST api/alerting/rule/41893910-6bca-11eb-9e0d-85d233e3ee35/alert/dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2/_mute
--------------------------------------------------
// KIBANA
29 changes: 21 additions & 8 deletions docs/api/alerting/mute_all_alerts.asciidoc
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
[[mute-all-alerts-api]]
=== Mute all alerts API
== Mute all alerts API
++++
<titleabbrev>Mute all alerts</titleabbrev>
++++

Mute all alerts.

[[mute-all-alerts-api-request]]
==== Request
=== {api-request-title}

`POST <kibana host>:<port>/api/alerting/rule/<id>/_mute_all`

`POST <kibana host>:<port>/s/<space_id>/api/alerting/rule/<id>/_mute_all`

=== {api-prereq-title}

You must have `all` privileges for the appropriate {kib} features, depending on
the `consumer` and `rule_type_id` of the rules you're creating. For example, the
*Management* > *Stack Rules* feature, *Analytics* > *Discover* and *{ml-app}*
features, *{observability}*, and *Security* features. If the rule has `actions`,
you must also have `read` privileges for the *Management* >
*Actions and Connectors* feature. For more details, refer to
<<kibana-feature-privileges>>.

=== {api-description-title}

This API snoozes the notifications for the rule indefinitely. The rule checks
continue to occur but alerts will not trigger any actions.

[[mute-all-alerts-api-path-params]]
==== Path parameters
=== {api-path-parms-title}

`id`::
(Required, string) The ID of the rule whose alerts you want to mute.
Expand All @@ -23,17 +38,15 @@ Mute all alerts.
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.

[[mute-all-alerts-api-response-codes]]
==== Response code
=== {api-response-codes-title}

`200`::
Indicates a successful call.

==== Example

Mute all alerts with ID:
=== {api-examples-title}

[source,sh]
--------------------------------------------------
$ curl -X POST api/alerting/rule/41893910-6bca-11eb-9e0d-85d233e3ee35/_mute_all
POST api/alerting/rule/41893910-6bca-11eb-9e0d-85d233e3ee35/_mute_all
--------------------------------------------------
// KIBANA
30 changes: 19 additions & 11 deletions docs/api/alerting/unmute_alert.asciidoc
Original file line number Diff line number Diff line change
@@ -1,42 +1,50 @@
[[unmute-alert-api]]
=== Unmute alert API
== Unmute alert API
++++
<titleabbrev>Unmute alert</titleabbrev>
++++

Unmute an alert.

[[unmute-alert-api-request]]
==== Request
=== {api-request-title}

`POST <kibana host>:<port>/api/alerting/rule/<rule_id>/alert/<alert_id>/_unmute`

`POST <kibana host>:<port>/s/<space_id>/api/alerting/rule/<rule_id>/alert/<alert_id>/_unmute`

[[unmute-alert-api-path-params]]
==== Path parameters
=== {api-prereq-title}

`rule_id`::
(Required, string) The ID of the rule whose alert you want to mute.
You must have `all` privileges for the appropriate {kib} features, depending on
the `consumer` and `rule_type_id` of the rules you're creating. For example, the
*Management* > *Stack Rules* feature, *Analytics* > *Discover* and *{ml-app}*
features, *{observability}*, and *Security* features. If the rule has `actions`,
you must also have `read` privileges for the *Management* >
*Actions and Connectors* feature. For more details, refer to
<<kibana-feature-privileges>>.

[[unmute-alert-api-path-params]]
=== {api-path-parms-title}

`alert_id`::
(Required, string) The ID of the alert that you want to unmute. The `alert_id` is generated by the rule and might be any arbitrary string.

`rule_id`::
(Required, string) The ID of the rule whose alert you want to mute.

`space_id`::
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.

[[unmute-alert-api-response-codes]]
==== Response code
=== {api-response-codes-title}

`200`::
Indicates a successful call.

==== Example

Unmute alert with ID:
=== {api-examples-title}

[source,sh]
--------------------------------------------------
$ curl -X POST api/alerting/rule/41893910-6bca-11eb-9e0d-85d233e3ee35/alert/dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2/_unmute
POST api/alerting/rule/41893910-6bca-11eb-9e0d-85d233e3ee35/alert/dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2/_unmute
--------------------------------------------------
// KIBANA
29 changes: 21 additions & 8 deletions docs/api/alerting/unmute_all_alerts.asciidoc
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
[[unmute-all-alerts-api]]
=== Unmute all alerts API
== Unmute all alerts API
++++
<titleabbrev>Unmute all alerts</titleabbrev>
++++

Unmute all alerts.

[[unmute-all-alerts-api-all-request]]
==== Request
=== {api-request-title}

`POST <kibana host>:<port>/api/alerting/rule/<id>/_unmute_all`

`POST <kibana host>:<port>/s/<space_id>/api/alerting/rule/<id>/_unmute_all`

=== {api-prereq-title}

You must have `all` privileges for the appropriate {kib} features, depending on
the `consumer` and `rule_type_id` of the rules you're creating. For example, the
*Management* > *Stack Rules* feature, *Analytics* > *Discover* and *{ml-app}*
features, *{observability}*, and *Security* features. If the rule has `actions`,
you must also have `read` privileges for the *Management* >
*Actions and Connectors* feature. For more details, refer to
<<kibana-feature-privileges>>.

=== {api-description-title}

If the rule has its notifications snoozed indefinitely, this API cancels the
snooze.

[[unmute-all-alerts-api-path-params]]
==== Path parameters
=== {api-path-parms-title}

`id`::
(Required, string) The ID of the rule whose alerts you want to unmute.
Expand All @@ -23,17 +38,15 @@ Unmute all alerts.
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.

[[unmute-all-alerts-api-response-codes]]
==== Response code
=== {api-response-codes-title}

`200`::
Indicates a successful call.

==== Example

Unmute all alerts with ID:
=== {api-examples-title}

[source,sh]
--------------------------------------------------
$ curl -X POST api/alerting/rule/41893910-6bca-11eb-9e0d-85d233e3ee35/_unmute_all
POST api/alerting/rule/41893910-6bca-11eb-9e0d-85d233e3ee35/_unmute_all
--------------------------------------------------
// KIBANA
16 changes: 14 additions & 2 deletions src/plugins/data/common/search/aggs/metrics/std_deviation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import { METRIC_TYPES } from './metric_agg_types';

describe('AggTypeMetricStandardDeviationProvider class', () => {
const typesRegistry = mockAggTypesRegistry();
const getAggConfigs = (customLabel?: string) => {
const getAggConfigs = ({
customLabel,
showBounds,
}: { customLabel?: string; showBounds?: boolean } = {}) => {
const field = {
name: 'memory',
};
Expand All @@ -38,6 +41,7 @@ describe('AggTypeMetricStandardDeviationProvider class', () => {
displayName: 'memory',
},
customLabel,
...(showBounds != null ? { showBounds } : {}),
},
},
],
Expand All @@ -47,7 +51,7 @@ describe('AggTypeMetricStandardDeviationProvider class', () => {
};

it('uses the custom label if it is set', () => {
const aggConfigs = getAggConfigs('custom label');
const aggConfigs = getAggConfigs({ customLabel: 'custom label' });
const responseAggs: any = getStdDeviationMetricAgg().getResponseAggs(
aggConfigs.aggs[0] as IStdDevAggConfig
);
Expand Down Expand Up @@ -102,4 +106,12 @@ describe('AggTypeMetricStandardDeviationProvider class', () => {
}
`);
});

it('returns null without throwing if no "extended_stats" is returned', () => {
const aggConfigs = getAggConfigs({ showBounds: false });

expect(() =>
getStdDeviationMetricAgg().getValue(aggConfigs.aggs[0] as IStdDevAggConfig, {})
).not.toThrow();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export const getStdDeviationMetricAgg = () => {
getValue(agg, bucket) {
const showBounds = agg.getParam('showBounds');
if (showBounds === false) {
return bucket[agg.id].std_deviation;
return bucket[agg.id]?.std_deviation;
}
return get(bucket[agg.parentId], agg.valProp());
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import React, { FC, ReactNode, useEffect, useState } from 'react';
import React, { FC, ReactNode, useMemo } from 'react';
import {
EuiBasicTable,
EuiFlexItem,
Expand All @@ -19,11 +19,7 @@ import { FormattedMessage } from '@kbn/i18n-react';
import { i18n } from '@kbn/i18n';
import type { FieldDataRowProps } from '../../types/field_data_row';
import { kibanaFieldFormat, numberAsOrdinal } from '../../../utils';
import {
MetricDistributionChart,
MetricDistributionChartData,
buildChartDataFromStats,
} from '../metric_distribution_chart';
import { MetricDistributionChart, buildChartDataFromStats } from '../metric_distribution_chart';
import { TopValues } from '../../../top_values';
import { ExpandedRowFieldHeader } from '../expanded_row_field_header';
import { DocumentStatsTable } from './document_stats';
Expand All @@ -42,14 +38,10 @@ interface SummaryTableItem {
export const NumberContent: FC<FieldDataRowProps> = ({ config, onAddFilter }) => {
const { stats } = config;

useEffect(() => {
const chartData = buildChartDataFromStats(stats, METRIC_DISTRIBUTION_CHART_WIDTH);
setDistributionChartData(chartData);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const defaultChartData: MetricDistributionChartData[] = [];
const [distributionChartData, setDistributionChartData] = useState(defaultChartData);
const distributionChartData = useMemo(
() => buildChartDataFromStats(stats?.distribution, METRIC_DISTRIBUTION_CHART_WIDTH),
[stats?.distribution]
);

if (stats === undefined) return null;
const { min, median, max, distribution } = stats;
Expand Down
Loading

0 comments on commit 4e90ce6

Please sign in to comment.