mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* [Metrics UI] Fix OR logic on redundant groupBy detection * Switch regex change to doc change * Fix core docs links * Update x-pack/plugins/infra/public/alerting/metric_threshold/components/expression.tsx Co-authored-by: Sandra G <neptunian@users.noreply.github.com> Co-authored-by: Sandra G <neptunian@users.noreply.github.com> Co-authored-by: Zacqary Adam Xeper <Zacqary@users.noreply.github.com> Co-authored-by: Sandra G <neptunian@users.noreply.github.com>
This commit is contained in:
parent
6cd0dc3886
commit
c24b8a6bf0
2 changed files with 19 additions and 5 deletions
|
@ -303,9 +303,9 @@ export class DocLinksService {
|
|||
},
|
||||
observability: {
|
||||
guide: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/index.html`,
|
||||
infrastructureThreshold: `{ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/infrastructure-threshold-alert.html`,
|
||||
logsThreshold: `{ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/logs-threshold-alert.html`,
|
||||
metricsThreshold: `{ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/metrics-threshold-alert.html`,
|
||||
infrastructureThreshold: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/infrastructure-threshold-alert.html`,
|
||||
logsThreshold: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/logs-threshold-alert.html`,
|
||||
metricsThreshold: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/metrics-threshold-alert.html`,
|
||||
monitorStatus: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/monitor-status-alert.html`,
|
||||
monitorUptime: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/monitor-uptime.html`,
|
||||
tlsCertificate: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/tls-certificate-alert.html`,
|
||||
|
|
|
@ -19,6 +19,7 @@ import {
|
|||
EuiFieldSearch,
|
||||
EuiAccordion,
|
||||
EuiPanel,
|
||||
EuiLink,
|
||||
} from '@elastic/eui';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
@ -58,7 +59,7 @@ export { defaultExpression };
|
|||
|
||||
export const Expressions: React.FC<Props> = (props) => {
|
||||
const { setAlertParams, alertParams, errors, metadata } = props;
|
||||
const { http, notifications } = useKibanaContextForPlugin().services;
|
||||
const { http, notifications, docLinks } = useKibanaContextForPlugin().services;
|
||||
const { source, createDerivedIndexPattern } = useSourceViaHttp({
|
||||
sourceId: 'default',
|
||||
fetch: http.fetch,
|
||||
|
@ -260,6 +261,9 @@ export const Expressions: React.FC<Props> = (props) => {
|
|||
[alertParams.groupBy]
|
||||
);
|
||||
|
||||
// Test to see if any of the group fields in groupBy are already filtered down to a single
|
||||
// group by the filterQuery. If this is the case, then a groupBy is unnecessary, as it would only
|
||||
// ever produce one group instance
|
||||
const groupByFilterTestPatterns = useMemo(() => {
|
||||
if (!alertParams.groupBy) return null;
|
||||
const groups = !Array.isArray(alertParams.groupBy)
|
||||
|
@ -456,10 +460,20 @@ export const Expressions: React.FC<Props> = (props) => {
|
|||
<EuiText size="xs" color="danger">
|
||||
<FormattedMessage
|
||||
id="xpack.infra.metrics.alertFlyout.alertPerRedundantFilterError"
|
||||
defaultMessage="This rule will only alert per one {matchedGroups} because the filter query contains an exact match for {groupCount, plural, one {this field} other {these fields}}."
|
||||
defaultMessage="This rule may alert on {matchedGroups} less than expected, because the filter query contains a match for {groupCount, plural, one {this field} other {these fields}}. For more information, refer to {filteringAndGroupingLink}."
|
||||
values={{
|
||||
matchedGroups: <strong>{redundantFilterGroupBy.join(', ')}</strong>,
|
||||
groupCount: redundantFilterGroupBy.length,
|
||||
filteringAndGroupingLink: (
|
||||
<EuiLink
|
||||
href={`${docLinks.links.observability.metricsThreshold}#filtering-and-grouping`}
|
||||
>
|
||||
{i18n.translate(
|
||||
'xpack.infra.metrics.alertFlyout.alertPerRedundantFilterError.docsLink',
|
||||
{ defaultMessage: 'the docs' }
|
||||
)}
|
||||
</EuiLink>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</EuiText>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue