Skip to content

Commit 32aaa36

Browse files
rmyzNicholasPeretti
authored andcommitted
[ObsUX][Infra] Ensure Infra Inventory UIs reflect supported schemas (elastic#244481)
1 parent ea910ba commit 32aaa36

15 files changed

Lines changed: 432 additions & 25 deletions

File tree

src/platform/packages/shared/kbn-synthtrace-client/src/lib/infra/docker_container.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ interface DockerContainerDocument extends Fields {
2323
'cloud.instance.id'?: string;
2424
'cloud.image.id'?: string;
2525
'event.dataset'?: string;
26+
'event.module'?: string;
2627
}
2728

2829
export class DockerContainer extends Entity<DockerContainerDocument> {
@@ -61,5 +62,6 @@ export function dockerContainer(id: string): DockerContainer {
6162
'cloud.image.id': 'image-1',
6263
'cloud.provider': 'aws',
6364
'event.dataset': 'docker.container',
65+
'event.module': 'docker',
6466
});
6567
}

src/platform/packages/shared/kbn-synthtrace-client/src/lib/infra/k8s_container.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ interface K8sContainerDocument extends Fields {
2626
'cloud.instance.id'?: string;
2727
'cloud.image.id'?: string;
2828
'event.dataset'?: string;
29+
'event.module'?: string;
2930
'agent.id': string;
3031
}
3132

@@ -63,5 +64,6 @@ export function k8sContainer(id: string, uid: string, nodeName: string): K8sCont
6364
'cloud.image.id': 'image-1',
6465
'cloud.provider': 'aws',
6566
'event.dataset': 'kubernetes.container',
67+
'event.module': 'kubernetes',
6668
});
6769
}

src/platform/packages/shared/kbn-synthtrace-client/src/lib/infra/k8s_node.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ interface K8sNodeDocument extends Fields {
2020
'host.name': string;
2121
'metricset.name'?: string;
2222
'event.dataset'?: string;
23+
'event.module'?: string;
2324
}
2425

2526
export class K8sNode extends Entity<K8sNodeDocument> {
@@ -57,5 +58,6 @@ export function k8sNode(name: string, podUid: string) {
5758
'host.hostname': name,
5859
'host.name': name,
5960
'event.dataset': 'kubernetes.node',
61+
'event.module': 'kubernetes',
6062
});
6163
}

src/platform/packages/shared/kbn-synthtrace-client/src/lib/infra/pod.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ interface PodDocument extends Fields {
2020
'kubernetes.pod.uid': string;
2121
'kubernetes.node.name': string;
2222
'metricset.name'?: string;
23+
'event.module'?: string;
2324
}
2425

2526
export class Pod extends Entity<PodDocument> {
@@ -48,5 +49,6 @@ export function pod(uid: string, nodeName: string) {
4849
'agent.id': 'synthtrace',
4950
'host.hostname': nodeName,
5051
'host.name': nodeName,
52+
'event.module': 'kubernetes',
5153
});
5254
}

x-pack/solutions/observability/plugins/infra/public/alerting/inventory/components/expression.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ import { convertKueryToElasticSearchQuery } from '../../../utils/kuery';
6262
import { ExpressionChart } from './expression_chart';
6363
import { MetricExpression } from './metrics_expression';
6464
import { ExpressionDropDown } from './expression_dropdown';
65+
import { SupportedDataTooltipLink } from '../../../components/supported_data_tooltip_link';
6566

6667
export interface AlertContextMeta {
6768
accountId?: string;
@@ -289,7 +290,7 @@ export const Expressions: React.FC<ExpressionsProps> = (props) => {
289290
</h4>
290291
</EuiText>
291292
<div css={StyledExpressionCss}>
292-
<EuiFlexGroup css={StyledExpressionRowCss}>
293+
<EuiFlexGroup css={StyledExpressionRowCss} gutterSize="s">
293294
<div css={NonCollapsibleExpressionCss}>
294295
<ExpressionDropDown
295296
options={nodeTypeOptions}
@@ -316,11 +317,12 @@ export const Expressions: React.FC<ExpressionsProps> = (props) => {
316317
)}
317318
/>
318319
</div>
320+
<SupportedDataTooltipLink nodeType={ruleParams.nodeType} isAlertUI />
319321
</EuiFlexGroup>
320322
</div>
321323
{ruleParams.nodeType === 'host' && (
322324
<div css={StyledExpressionCss}>
323-
<EuiFlexGroup css={StyledExpressionRowCss}>
325+
<EuiFlexGroup css={StyledExpressionRowCss} gutterSize="xs">
324326
<div css={NonCollapsibleExpressionCss}>
325327
<ExpressionDropDown
326328
options={schemaOptions}
@@ -640,7 +642,7 @@ export const ExpressionRow = (props: PropsWithChildren<ExpressionRowProps>) => {
640642
</EuiFlexItem>
641643

642644
<EuiFlexItem grow>
643-
<EuiFlexGroup css={StyledExpressionRowCss}>
645+
<EuiFlexGroup css={StyledExpressionRowCss} gutterSize="xs">
644646
<div css={StyledExpressionCss}>
645647
<MetricExpression
646648
metric={{
@@ -664,7 +666,7 @@ export const ExpressionRow = (props: PropsWithChildren<ExpressionRowProps>) => {
664666
</EuiFlexGroup>
665667
{displayWarningThreshold && (
666668
<>
667-
<EuiFlexGroup css={StyledExpressionRowCss}>
669+
<EuiFlexGroup css={StyledExpressionRowCss} alignItems="center" gutterSize="xs">
668670
{criticalThresholdExpression}
669671
<EuiHealth css={StyledHealthCss} color="danger">
670672
<FormattedMessage
@@ -673,7 +675,7 @@ export const ExpressionRow = (props: PropsWithChildren<ExpressionRowProps>) => {
673675
/>
674676
</EuiHealth>
675677
</EuiFlexGroup>
676-
<EuiFlexGroup css={StyledExpressionRowCss}>
678+
<EuiFlexGroup css={StyledExpressionRowCss} alignItems="center" gutterSize="xs">
677679
{warningThresholdExpression}
678680
<EuiHealth css={StyledHealthCss} color="warning">
679681
<FormattedMessage
@@ -701,7 +703,7 @@ export const ExpressionRow = (props: PropsWithChildren<ExpressionRowProps>) => {
701703
<>
702704
{' '}
703705
<EuiSpacer size="xs" />
704-
<EuiFlexGroup css={StyledExpressionRowCss}>
706+
<EuiFlexGroup css={StyledExpressionRowCss} gutterSize="xs">
705707
<EuiButtonEmpty
706708
aria-label={i18n.translate(
707709
'xpack.infra.expressionRow.addwarningthresholdButton.ariaLabel',
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { EuiLink, EuiToolTip, useEuiTheme } from '@elastic/eui';
9+
import { i18n } from '@kbn/i18n';
10+
import React from 'react';
11+
import type { InventoryItemType } from '@kbn/metrics-data-access-plugin/common';
12+
13+
export const INTEGRATIONS: Record<
14+
InventoryItemType,
15+
{ inventoryLabel: string; documentation: string; alertingLabel?: string }
16+
> = {
17+
host: {
18+
inventoryLabel: i18n.translate('xpack.infra.supportedDataTooltipLink.hostIntegrationInfo', {
19+
defaultMessage:
20+
'This view supports data from the OpenTelemetry and Elastic System Integration.',
21+
}),
22+
alertingLabel: i18n.translate(
23+
'xpack.infra.supportedDataTooltipLink.hostIntegrationInfoAlerting',
24+
{
25+
defaultMessage:
26+
'This alert rule supports data from the OpenTelemetry and Elastic System Integration.',
27+
}
28+
),
29+
documentation: 'https://ela.st/infra-inventory-supported-data-hosts',
30+
},
31+
pod: {
32+
inventoryLabel: i18n.translate(
33+
'xpack.infra.supportedDataTooltipLink.kubernetesIntegrationInfo',
34+
{
35+
defaultMessage: 'This view supports data from the Kubernetes Integration.',
36+
}
37+
),
38+
alertingLabel: i18n.translate(
39+
'xpack.infra.supportedDataTooltipLink.kubernetesIntegrationInfoAlerting',
40+
{
41+
defaultMessage: 'This alert rule supports data from the Kubernetes Integration.',
42+
}
43+
),
44+
documentation: 'https://ela.st/infra-inventory-supported-data-k8s-pods',
45+
},
46+
container: {
47+
inventoryLabel: i18n.translate(
48+
'xpack.infra.supportedDataTooltipLink.dockerContainerIntegrationInfo',
49+
{
50+
defaultMessage:
51+
'This view supports data from the Kubernetes, System and Docker Integrations.',
52+
}
53+
),
54+
alertingLabel: i18n.translate(
55+
'xpack.infra.supportedDataTooltipLink.dockerContainerIntegrationInfoAlerting',
56+
{
57+
defaultMessage:
58+
'This alert rule supports data from the Kubernetes, System and Docker Integrations.',
59+
}
60+
),
61+
documentation: 'https://ela.st/infra-inventory-supported-data-containers',
62+
},
63+
awsEC2: {
64+
inventoryLabel: i18n.translate('xpack.infra.supportedDataTooltipLink.awsEC2IntegrationInfo', {
65+
defaultMessage: 'This view supports data from the AWS EC2 Integration.',
66+
}),
67+
alertingLabel: i18n.translate(
68+
'xpack.infra.supportedDataTooltipLink.awsEC2IntegrationInfoAlerting',
69+
{
70+
defaultMessage: 'This alert rule supports data from the AWS EC2 Integration.',
71+
}
72+
),
73+
documentation: 'https://ela.st/infra-inventory-supported-data-aws-ec2',
74+
},
75+
awsRDS: {
76+
inventoryLabel: i18n.translate('xpack.infra.supportedDataTooltipLink.awsRDSIntegrationInfo', {
77+
defaultMessage: 'This view supports data from the AWS RDS Integration.',
78+
}),
79+
alertingLabel: i18n.translate(
80+
'xpack.infra.supportedDataTooltipLink.awsRDSIntegrationInfoAlerting',
81+
{
82+
defaultMessage: 'This alert rule supports data from the AWS RDS Integration.',
83+
}
84+
),
85+
documentation: 'https://ela.st/infra-inventory-supported-data-aws-rds',
86+
},
87+
awsS3: {
88+
inventoryLabel: i18n.translate('xpack.infra.supportedDataTooltipLink.awsS3IntegrationInfo', {
89+
defaultMessage: 'This view supports data from the AWS S3 Integration.',
90+
}),
91+
alertingLabel: i18n.translate(
92+
'xpack.infra.supportedDataTooltipLink.awsS3IntegrationInfoAlerting',
93+
{
94+
defaultMessage: 'This alert rule supports data from the AWS S3 Integration.',
95+
}
96+
),
97+
documentation: 'https://ela.st/infra-inventory-supported-data-aws-s3',
98+
},
99+
awsSQS: {
100+
inventoryLabel: i18n.translate('xpack.infra.supportedDataTooltipLink.awsSQSIntegrationInfo', {
101+
defaultMessage: 'This view supports data from the AWS SQS Integration.',
102+
}),
103+
alertingLabel: i18n.translate(
104+
'xpack.infra.supportedDataTooltipLink.awsSQSIntegrationInfoAlerting',
105+
{
106+
defaultMessage: 'This alert rule supports data from the AWS SQS Integration.',
107+
}
108+
),
109+
documentation: 'https://ela.st/infra-inventory-supported-data-aws-sqs',
110+
},
111+
} as const;
112+
113+
export function SupportedDataTooltipLink({
114+
nodeType = 'host',
115+
isAlertUI = false,
116+
}: {
117+
nodeType: InventoryItemType;
118+
isAlertUI?: boolean;
119+
}) {
120+
const { euiTheme } = useEuiTheme();
121+
122+
return (
123+
<EuiToolTip
124+
content={
125+
isAlertUI ? INTEGRATIONS[nodeType].alertingLabel : INTEGRATIONS[nodeType].inventoryLabel
126+
}
127+
>
128+
<EuiLink
129+
data-test-subj="infraSupportedDataTooltipLink"
130+
href={INTEGRATIONS[nodeType].documentation}
131+
target="_blank"
132+
external
133+
css={{
134+
height: !isAlertUI ? euiTheme.size.xl : '30px',
135+
display: 'inline-flex',
136+
alignItems: 'center',
137+
}}
138+
>
139+
{i18n.translate('xpack.infra.supportedDataTooltipLink.label', {
140+
defaultMessage: 'What data is supported?',
141+
})}
142+
</EuiLink>
143+
</EuiToolTip>
144+
);
145+
}

x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/nodes_overview.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
import { i18n } from '@kbn/i18n';
99
import { usePerformanceContext } from '@kbn/ebt-tools';
1010
import React, { useCallback, useMemo } from 'react';
11-
import { useCurrentEuiBreakpoint } from '@elastic/eui';
11+
import { EuiLink, useCurrentEuiBreakpoint } from '@elastic/eui';
1212
import styled from '@emotion/styled';
1313
import type { DataSchemaFormat, InventoryItemType } from '@kbn/metrics-data-access-plugin/common';
1414
import moment from 'moment';
15+
import { FormattedMessage } from '@kbn/i18n-react';
1516
import { SwitchSchemaMessage } from '../../../../components/shared/switch_schema_message';
1617
import { useTimeRangeMetadataContext } from '../../../../hooks/use_time_range_metadata';
1718
import type {
@@ -30,6 +31,7 @@ import { useAssetDetailsFlyoutState } from '../hooks/use_asset_details_flyout_ur
3031
import { AssetDetailsFlyout } from './waffle/asset_details_flyout';
3132
import { useWaffleOptionsContext } from '../hooks/use_waffle_options';
3233
import { useWaffleTimeContext } from '../hooks/use_waffle_time';
34+
import { INTEGRATIONS } from '../../../../components/supported_data_tooltip_link';
3335

3436
export interface KueryFilterQuery {
3537
kind: 'kuery';
@@ -137,9 +139,23 @@ export const NodesOverview = ({
137139
hasDataOnAnotherSchema ? (
138140
<SwitchSchemaMessage dataTestSubj="infraInventoryViewNoDataInSelectedSchema" />
139141
) : (
140-
i18n.translate('xpack.infra.waffle.noDataDescription', {
141-
defaultMessage: 'Try adjusting your time or filter.',
142-
})
142+
<FormattedMessage
143+
id="xpack.infra.waffle.noDataSupportedIntegrationDescription"
144+
defaultMessage="Try modifying your filter and ensure that you are sending data from the {supportedIntegration} for this view."
145+
values={{
146+
supportedIntegration: (
147+
<EuiLink
148+
data-test-subj="infraNodesOverviewNoDataSupportedIntegrationLink"
149+
href={INTEGRATIONS[nodeType].documentation}
150+
target="_blank"
151+
>
152+
{i18n.translate('xpack.infra.waffle.noData.supportedIntegration', {
153+
defaultMessage: 'supported integration',
154+
})}
155+
</EuiLink>
156+
),
157+
}}
158+
/>
143159
)
144160
}
145161
{...refetchProps}

x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/toolbars/metrics_and_groupby_toolbar_items.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { WaffleMetricControls } from '../waffle/metric_control';
1818
import { WaffleGroupByControls } from '../waffle/waffle_group_by_controls';
1919
import { WaffleSortControls } from '../waffle/waffle_sort_controls';
2020
import type { ToolbarProps } from './types';
21+
import { SupportedDataTooltipLink } from '../../../../../components/supported_data_tooltip_link';
2122

2223
interface Props extends ToolbarProps {
2324
groupByFields: string[];
@@ -110,6 +111,9 @@ export const MetricsAndGroupByToolbarItems = ({
110111
/>
111112
</EuiFlexItem>
112113
)}
114+
<EuiFlexItem grow={false}>
115+
<SupportedDataTooltipLink nodeType={props.nodeType} />
116+
</EuiFlexItem>
113117
</>
114118
);
115119
};

0 commit comments

Comments
 (0)