Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface DockerContainerDocument extends Fields {
'cloud.instance.id'?: string;
'cloud.image.id'?: string;
'event.dataset'?: string;
'event.module'?: string;
}

export class DockerContainer extends Entity<DockerContainerDocument> {
Expand Down Expand Up @@ -61,5 +62,6 @@ export function dockerContainer(id: string): DockerContainer {
'cloud.image.id': 'image-1',
'cloud.provider': 'aws',
'event.dataset': 'docker.container',
'event.module': 'docker',
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ interface K8sContainerDocument extends Fields {
'cloud.instance.id'?: string;
'cloud.image.id'?: string;
'event.dataset'?: string;
'event.module'?: string;
'agent.id': string;
}

Expand Down Expand Up @@ -63,5 +64,6 @@ export function k8sContainer(id: string, uid: string, nodeName: string): K8sCont
'cloud.image.id': 'image-1',
'cloud.provider': 'aws',
'event.dataset': 'kubernetes.container',
'event.module': 'kubernetes',
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface K8sNodeDocument extends Fields {
'host.name': string;
'metricset.name'?: string;
'event.dataset'?: string;
'event.module'?: string;
}

export class K8sNode extends Entity<K8sNodeDocument> {
Expand Down Expand Up @@ -57,5 +58,6 @@ export function k8sNode(name: string, podUid: string) {
'host.hostname': name,
'host.name': name,
'event.dataset': 'kubernetes.node',
'event.module': 'kubernetes',
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface PodDocument extends Fields {
'kubernetes.pod.uid': string;
'kubernetes.node.name': string;
'metricset.name'?: string;
'event.module'?: string;
}

export class Pod extends Entity<PodDocument> {
Expand Down Expand Up @@ -48,5 +49,6 @@ export function pod(uid: string, nodeName: string) {
'agent.id': 'synthtrace',
'host.hostname': nodeName,
'host.name': nodeName,
'event.module': 'kubernetes',
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import { convertKueryToElasticSearchQuery } from '../../../utils/kuery';
import { ExpressionChart } from './expression_chart';
import { MetricExpression } from './metrics_expression';
import { ExpressionDropDown } from './expression_dropdown';
import { SupportedDataTooltipLink } from '../../../components/supported_data_tooltip_link';

export interface AlertContextMeta {
accountId?: string;
Expand Down Expand Up @@ -289,7 +290,7 @@ export const Expressions: React.FC<ExpressionsProps> = (props) => {
</h4>
</EuiText>
<div css={StyledExpressionCss}>
<EuiFlexGroup css={StyledExpressionRowCss}>
<EuiFlexGroup css={StyledExpressionRowCss} gutterSize="s">
<div css={NonCollapsibleExpressionCss}>
<ExpressionDropDown
options={nodeTypeOptions}
Expand All @@ -316,11 +317,12 @@ export const Expressions: React.FC<ExpressionsProps> = (props) => {
)}
/>
</div>
<SupportedDataTooltipLink nodeType={ruleParams.nodeType || 'host'} isAlertUI />
Comment thread
rmyz marked this conversation as resolved.
Outdated
</EuiFlexGroup>
</div>
{ruleParams.nodeType === 'host' && (
<div css={StyledExpressionCss}>
<EuiFlexGroup css={StyledExpressionRowCss}>
<EuiFlexGroup css={StyledExpressionRowCss} gutterSize="xs">
<div css={NonCollapsibleExpressionCss}>
<ExpressionDropDown
options={schemaOptions}
Expand Down Expand Up @@ -640,7 +642,7 @@ export const ExpressionRow = (props: PropsWithChildren<ExpressionRowProps>) => {
</EuiFlexItem>

<EuiFlexItem grow>
<EuiFlexGroup css={StyledExpressionRowCss}>
<EuiFlexGroup css={StyledExpressionRowCss} gutterSize="xs">
<div css={StyledExpressionCss}>
<MetricExpression
metric={{
Expand All @@ -664,7 +666,7 @@ export const ExpressionRow = (props: PropsWithChildren<ExpressionRowProps>) => {
</EuiFlexGroup>
{displayWarningThreshold && (
<>
<EuiFlexGroup css={StyledExpressionRowCss}>
<EuiFlexGroup css={StyledExpressionRowCss} alignItems="center" gutterSize="xs">
{criticalThresholdExpression}
<EuiHealth css={StyledHealthCss} color="danger">
<FormattedMessage
Expand All @@ -673,7 +675,7 @@ export const ExpressionRow = (props: PropsWithChildren<ExpressionRowProps>) => {
/>
</EuiHealth>
</EuiFlexGroup>
<EuiFlexGroup css={StyledExpressionRowCss}>
<EuiFlexGroup css={StyledExpressionRowCss} alignItems="center" gutterSize="xs">
{warningThresholdExpression}
<EuiHealth css={StyledHealthCss} color="warning">
<FormattedMessage
Expand Down Expand Up @@ -701,7 +703,7 @@ export const ExpressionRow = (props: PropsWithChildren<ExpressionRowProps>) => {
<>
{' '}
<EuiSpacer size="xs" />
<EuiFlexGroup css={StyledExpressionRowCss}>
<EuiFlexGroup css={StyledExpressionRowCss} gutterSize="xs">
<EuiButtonEmpty
aria-label={i18n.translate(
'xpack.infra.expressionRow.addwarningthresholdButton.ariaLabel',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { EuiLink, EuiToolTip, useEuiTheme } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';
import type { InventoryItemType } from '@kbn/metrics-data-access-plugin/common';

export const INTEGRATIONS: Record<
InventoryItemType,
{ inventoryLabel: string; documentation: string; alertingLabel?: string }
> = {
host: {
inventoryLabel: i18n.translate('xpack.infra.supportedDataTooltipLink.hostIntegrationInfo', {
defaultMessage:
'This view supports data from the OpenTelemetry and Elastic System Integration.',
}),
alertingLabel: i18n.translate(
'xpack.infra.supportedDataTooltipLink.hostIntegrationInfoAlerting',
{
defaultMessage:
'This alert rule supports data from the OpenTelemetry and Elastic System Integration.',
}
),
documentation: 'https://ela.st/infra-inventory-supported-data-hosts',
},
pod: {
inventoryLabel: i18n.translate(
'xpack.infra.supportedDataTooltipLink.kubernetesIntegrationInfo',
{
defaultMessage: 'This view supports data from the Kubernetes Integration.',
}
),
alertingLabel: i18n.translate(
'xpack.infra.supportedDataTooltipLink.kubernetesIntegrationInfoAlerting',
{
defaultMessage: 'This alert rule supports data from the Kubernetes Integration.',
}
),
documentation: 'https://ela.st/infra-inventory-supported-data-k8s-pods',
},
container: {
inventoryLabel: i18n.translate(
'xpack.infra.supportedDataTooltipLink.dockerContainerIntegrationInfo',
{
defaultMessage:
'This view supports data from the Kubernetes, System and Docker Integrations.',
}
),
alertingLabel: i18n.translate(
'xpack.infra.supportedDataTooltipLink.dockerContainerIntegrationInfoAlerting',
{
defaultMessage:
'This alert rule supports data from the Kubernetes, System and Docker Integrations.',
}
),
documentation: 'https://ela.st/infra-inventory-supported-data-containers',
},
awsEC2: {
inventoryLabel: i18n.translate('xpack.infra.supportedDataTooltipLink.awsEC2IntegrationInfo', {
defaultMessage: 'This view supports data from the AWS EC2 Integration.',
}),
alertingLabel: i18n.translate(
'xpack.infra.supportedDataTooltipLink.awsEC2IntegrationInfoAlerting',
{
defaultMessage: 'This alert rule supports data from the AWS EC2 Integration.',
}
),
documentation: 'https://ela.st/infra-inventory-supported-data-aws-ec2',
},
awsRDS: {
inventoryLabel: i18n.translate('xpack.infra.supportedDataTooltipLink.awsRDSIntegrationInfo', {
defaultMessage: 'This view supports data from the AWS RDS Integration.',
}),
alertingLabel: i18n.translate(
'xpack.infra.supportedDataTooltipLink.awsRDSIntegrationInfoAlerting',
{
defaultMessage: 'This alert rule supports data from the AWS RDS Integration.',
}
),
documentation: 'https://ela.st/infra-inventory-supported-data-aws-rds',
},
awsS3: {
inventoryLabel: i18n.translate('xpack.infra.supportedDataTooltipLink.awsS3IntegrationInfo', {
defaultMessage: 'This view supports data from the AWS S3 Integration.',
}),
alertingLabel: i18n.translate(
'xpack.infra.supportedDataTooltipLink.awsS3IntegrationInfoAlerting',
{
defaultMessage: 'This alert rule supports data from the AWS S3 Integration.',
}
),
documentation: 'https://ela.st/infra-inventory-supported-data-aws-s3',
},
awsSQS: {
inventoryLabel: i18n.translate('xpack.infra.supportedDataTooltipLink.awsSQSIntegrationInfo', {
defaultMessage: 'This view supports data from the AWS SQS Integration.',
}),
alertingLabel: i18n.translate(
'xpack.infra.supportedDataTooltipLink.awsSQSIntegrationInfoAlerting',
{
defaultMessage: 'This alert rule supports data from the AWS SQS Integration.',
}
),
documentation: 'https://ela.st/infra-inventory-supported-data-aws-sqs',
},
} as const;

export function SupportedDataTooltipLink({
nodeType,
isAlertUI = false,
}: {
nodeType: InventoryItemType;
isAlertUI?: boolean;
}) {
const { euiTheme } = useEuiTheme();

return (
<EuiToolTip
content={
isAlertUI ? INTEGRATIONS[nodeType].alertingLabel : INTEGRATIONS[nodeType].inventoryLabel
}
>
<EuiLink
data-test-subj="infraSupportedDataTooltipLink"
href={INTEGRATIONS[nodeType].documentation}
target="_blank"
external
css={{
height: !isAlertUI ? euiTheme.size.xl : '30px',
display: 'inline-flex',
alignItems: 'center',
}}
>
{i18n.translate('xpack.infra.supportedDataTooltipLink.label', {
defaultMessage: 'What data is supported?',
})}
</EuiLink>
</EuiToolTip>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
import { i18n } from '@kbn/i18n';
import { usePerformanceContext } from '@kbn/ebt-tools';
import React, { useCallback, useMemo } from 'react';
import { useCurrentEuiBreakpoint } from '@elastic/eui';
import { EuiLink, useCurrentEuiBreakpoint } from '@elastic/eui';
import styled from '@emotion/styled';
import type { DataSchemaFormat, InventoryItemType } from '@kbn/metrics-data-access-plugin/common';
import moment from 'moment';
import { FormattedMessage } from '@kbn/i18n-react';
import { SwitchSchemaMessage } from '../../../../components/shared/switch_schema_message';
import { useTimeRangeMetadataContext } from '../../../../hooks/use_time_range_metadata';
import type {
Expand All @@ -30,6 +31,7 @@ import { useAssetDetailsFlyoutState } from '../hooks/use_asset_details_flyout_ur
import { AssetDetailsFlyout } from './waffle/asset_details_flyout';
import { useWaffleOptionsContext } from '../hooks/use_waffle_options';
import { useWaffleTimeContext } from '../hooks/use_waffle_time';
import { INTEGRATIONS } from '../../../../components/supported_data_tooltip_link';

export interface KueryFilterQuery {
kind: 'kuery';
Expand Down Expand Up @@ -137,9 +139,23 @@ export const NodesOverview = ({
hasDataOnAnotherSchema ? (
<SwitchSchemaMessage dataTestSubj="infraInventoryViewNoDataInSelectedSchema" />
) : (
i18n.translate('xpack.infra.waffle.noDataDescription', {
defaultMessage: 'Try adjusting your time or filter.',
})
<FormattedMessage
id="xpack.infra.waffle.noDataSupportedIntegrationDescription"
defaultMessage="Try modifying your filter and ensure that you are sending data from the {supportedIntegration} for this view."
values={{
supportedIntegration: (
<EuiLink
data-test-subj="infraNodesOverviewNoDataSupportedIntegrationLink"
href={INTEGRATIONS[nodeType].documentation}
target="_blank"
>
{i18n.translate('xpack.infra.waffle.noData.supportedIntegration', {
defaultMessage: 'supported integration',
})}
</EuiLink>
),
}}
/>
)
}
{...refetchProps}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { WaffleMetricControls } from '../waffle/metric_control';
import { WaffleGroupByControls } from '../waffle/waffle_group_by_controls';
import { WaffleSortControls } from '../waffle/waffle_sort_controls';
import type { ToolbarProps } from './types';
import { SupportedDataTooltipLink } from '../../../../../components/supported_data_tooltip_link';

interface Props extends ToolbarProps {
groupByFields: string[];
Expand Down Expand Up @@ -110,6 +111,9 @@ export const MetricsAndGroupByToolbarItems = ({
/>
</EuiFlexItem>
)}
<EuiFlexItem grow={false}>
<SupportedDataTooltipLink nodeType={props.nodeType} />
</EuiFlexItem>
</>
);
};
Loading