Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Metrics UI] Add AWS Metricsets to Inventory Models #49983

Merged
merged 36 commits into from
Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
32487d1
Adding initial code for EC2
simianhacker Nov 1, 2019
724848a
Removing obsolute files; Adding EC2;
simianhacker Nov 11, 2019
ddfa427
Removing currentTimerange and replacing it with currentTime; Timerang…
simianhacker Nov 12, 2019
1dcc91c
Fixing AWS.s3 with Metrics Explorer
simianhacker Nov 13, 2019
da9359d
Merge branch 'master' of github.com:elastic/kibana into aws-ec2
simianhacker Nov 14, 2019
a9d4684
Auto calculating timerange and interval based on metricset.period
simianhacker Nov 14, 2019
1641cf1
Merge branch 'master' of github.com:elastic/kibana into aws-ec2
simianhacker Nov 18, 2019
bf2a3bb
Merge branch 'master' of github.com:elastic/kibana into aws-ec2
simianhacker Nov 20, 2019
e0aef39
Adding S3 metricset
simianhacker Nov 20, 2019
5414ec3
Inital addition of RDS metrics
simianhacker Nov 21, 2019
93a9d0d
Adding SQS and fixing a few things
simianhacker Nov 22, 2019
6ce5c0c
Fixing typescript error
simianhacker Nov 22, 2019
46a1ca3
Merge branch 'master' of github.com:elastic/kibana into aws-ec2
simianhacker Dec 3, 2019
84d58c5
Adding RDS; Adjusting fields for S3; adding new formatter
simianhacker Dec 4, 2019
050e935
Return 60 seconds by detault
simianhacker Dec 4, 2019
306b7c3
Fixing types
simianhacker Dec 4, 2019
e8739a1
Removing i18n
simianhacker Dec 4, 2019
36914d6
Fixing tests
simianhacker Dec 4, 2019
d20cb06
Fixing translations
simianhacker Dec 5, 2019
43a1b9b
Merge branch 'master' of github.com:elastic/kibana into aws-ec2
simianhacker Dec 9, 2019
ecc3de0
Merge branch 'master' of github.com:elastic/kibana into aws-ec2
simianhacker Dec 9, 2019
b140259
Fixes from merge
simianhacker Dec 9, 2019
e1f3dc4
Removing IDX from code not covered by #52354
simianhacker Dec 9, 2019
f076abf
fixing tests
simianhacker Dec 9, 2019
c8310b9
Merge branch 'master' of github.com:elastic/kibana into aws-ec2
simianhacker Dec 10, 2019
7926b5a
Adding controls for crossliking; consolidating display name
simianhacker Dec 10, 2019
c09bdac
remove obsolete import
simianhacker Dec 10, 2019
4a77e3e
Adding drop_last_bucket_support to TSVB models
simianhacker Dec 10, 2019
3a45d21
Changing type
simianhacker Dec 10, 2019
ce4eda5
Fixing value per type
simianhacker Dec 11, 2019
cab5a3a
remvoing obsolete translation
simianhacker Dec 11, 2019
f662730
Merge branch 'master' of github.com:elastic/kibana into aws-ec2
simianhacker Dec 11, 2019
9b23276
Removing duplicate lines
simianhacker Dec 11, 2019
09555e5
Removing icons from switcher
simianhacker Dec 11, 2019
f083eb5
Reducing boilerplate in Toolbar Items
simianhacker Dec 12, 2019
53b507a
Changing file name
simianhacker Dec 12, 2019
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
6 changes: 6 additions & 0 deletions x-pack/legacy/plugins/infra/common/ecs_allowed_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export const DOCKER_ALLOWED_LIST = [
'docker.container.labels',
];

export const AWS_S3_ALLOWED_LIST = ['aws.s3'];

export const getAllowedListForPrefix = (prefix: string) => {
const firstPart = first(prefix.split(/\./));
const defaultAllowedList = prefix ? [...ECS_ALLOWED_LIST, prefix] : ECS_ALLOWED_LIST;
Expand All @@ -55,6 +57,10 @@ export const getAllowedListForPrefix = (prefix: string) => {
return [...defaultAllowedList, ...PROMETHEUS_ALLOWED_LIST];
case 'kubernetes':
return [...defaultAllowedList, ...K8S_ALLOWED_LIST];
case 'aws':
if (prefix === 'aws.s3_daily_storage') {
return [...defaultAllowedList, ...AWS_S3_ALLOWED_LIST];
}
default:
return defaultAllowedList;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,9 @@ export const sharedSchema = gql`
pod
container
host
awsEC2
awsS3
awsRDS
awsSQS
}
`;
38 changes: 38 additions & 0 deletions x-pack/legacy/plugins/infra/common/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,10 @@ export enum InfraNodeType {
pod = 'pod',
container = 'container',
host = 'host',
awsEC2 = 'awsEC2',
awsS3 = 'awsS3',
awsRDS = 'awsRDS',
awsSQS = 'awsSQS',
}

export enum InfraSnapshotMetricType {
Expand All @@ -562,6 +566,22 @@ export enum InfraSnapshotMetricType {
tx = 'tx',
rx = 'rx',
logRate = 'logRate',
diskIOReadBytes = 'diskIOReadBytes',
diskIOWriteBytes = 'diskIOWriteBytes',
s3TotalRequests = 's3TotalRequests',
s3NumberOfObjects = 's3NumberOfObjects',
s3BucketSize = 's3BucketSize',
s3DownloadBytes = 's3DownloadBytes',
s3UploadBytes = 's3UploadBytes',
rdsConnections = 'rdsConnections',
rdsQueriesExecuted = 'rdsQueriesExecuted',
rdsActiveTransactions = 'rdsActiveTransactions',
rdsLatency = 'rdsLatency',
sqsMessagesVisible = 'sqsOldestMessage',
sqsMessagesDelayed = 'sqsMessagesDelayed',
sqsMessagesSent = 'sqsMessagesSent',
sqsMessagesEmpty = 'sqsMessagesEmpty',
sqsOldestMessage = 'sqsOldestMessage',
}

export enum InfraMetric {
Expand Down Expand Up @@ -602,6 +622,24 @@ export enum InfraMetric {
awsNetworkPackets = 'awsNetworkPackets',
awsDiskioBytes = 'awsDiskioBytes',
awsDiskioOps = 'awsDiskioOps',
awsEC2CpuUtilization = 'awsEC2CpuUtilization',
awsEC2DiskIOBytes = 'awsEC2DiskIOBytes',
awsEC2NetworkTraffic = 'awsEC2NetworkTraffic',
awsS3TotalRequests = 'awsS3TotalRequests',
awsS3NumberOfObjects = 'awsS3NumberOfObjects',
awsS3BucketSize = 'awsS3BucketSize',
awsS3DownloadBytes = 'awsS3DownloadBytes',
awsS3UploadBytes = 'awsS3UploadBytes',
awsRDSCpuTotal = 'awsRDSCpuTotal',
awsRDSConnections = 'awsRDSConnections',
awsRDSQueriesExecuted = 'awsRDSQueriesExecuted',
awsRDSActiveTransactions = 'awsRDSActiveTransactions',
awsRDSLatency = 'awsRDSLatency',
awsSQSMessagesVisible = 'awsSQSMessagesVisible',
awsSQSMessagesDelayed = 'awsSQSMessagesDelayed',
awsSQSMessagesSent = 'awsSQSMessagesSent',
awsSQSMessagesEmpty = 'awsSQSMessagesEmpty',
awsSQSOldestMessage = 'awsSQSOldestMessage',
custom = 'custom',
}

Expand Down
11 changes: 2 additions & 9 deletions x-pack/legacy/plugins/infra/common/http_api/metadata_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@
*/

import * as rt from 'io-ts';

export const InfraMetadataNodeTypeRT = rt.keyof({
host: null,
pod: null,
container: null,
});
import { ItemTypeRT } from '../../common/inventory_models/types';

export const InfraMetadataRequestRT = rt.type({
nodeId: rt.string,
nodeType: InfraMetadataNodeTypeRT,
nodeType: ItemTypeRT,
sourceId: rt.string,
});

Expand Down Expand Up @@ -96,5 +91,3 @@ export type InfraMetadataMachine = rt.TypeOf<typeof InfraMetadataMachineRT>;
export type InfraMetadataHost = rt.TypeOf<typeof InfraMetadataHostRT>;

export type InfraMetadataOS = rt.TypeOf<typeof InfraMetadataOSRT>;

export type InfraMetadataNodeType = rt.TypeOf<typeof InfraMetadataNodeTypeRT>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { i18n } from '@kbn/i18n';
import { metrics } from './metrics';
import { InventoryModel } from '../types';

export const awsEC2: InventoryModel = {
id: 'awsEC2',
displayName: i18n.translate('xpack.infra.inventoryModels.awsEC2.displayName', {
defaultMessage: 'EC2 Instances',
}),
requiredModules: ['aws'],
crosslinkSupport: {
details: true,
logs: true,
apm: true,
uptime: true,
},
metrics,
fields: {
id: 'cloud.instance.id',
name: 'cloud.instance.name',
ip: 'aws.ec2.instance.public.ip',
},
requiredMetrics: ['awsEC2CpuUtilization', 'awsEC2NetworkTraffic', 'awsEC2DiskIOBytes'],
};
116 changes: 116 additions & 0 deletions x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
import { i18n } from '@kbn/i18n';
import { LayoutPropsWithTheme } from '../../../public/pages/metrics/types';
import { Section } from '../../../public/pages/metrics/components/section';
import { SubSection } from '../../../public/pages/metrics/components/sub_section';
import { ChartSectionVis } from '../../../public/pages/metrics/components/chart_section_vis';
import { withTheme } from '../../../../../common/eui_styled_components';

export const Layout = withTheme(({ metrics, theme }: LayoutPropsWithTheme) => (
<React.Fragment>
<Section
navLabel="AWS EC2"
sectionLabel={i18n.translate(
'xpack.infra.metricDetailPage.ec2MetricsLayout.overviewSection.sectionLabel',
{
defaultMessage: 'Aws EC2 Overview',
}
)}
metrics={metrics}
>
<SubSection
id="awsEC2CpuUtilization"
label={i18n.translate(
'xpack.infra.metricDetailPage.ec2MetricsLayout.cpuUsageSection.sectionLabel',
{
defaultMessage: 'CPU Usage',
}
)}
>
<ChartSectionVis
stacked={true}
type="area"
formatter="percent"
seriesOverrides={{
total: { color: theme.eui.euiColorVis1 },
}}
/>
</SubSection>
<SubSection
id="awsEC2NetworkTraffic"
label={i18n.translate(
'xpack.infra.metricDetailPage.ec2MetricsLayout.networkTrafficSection.sectionLabel',
{
defaultMessage: 'Network Traffic',
}
)}
>
<ChartSectionVis
formatter="bits"
formatterTemplate="{{value}}/s"
type="area"
seriesOverrides={{
rx: {
color: theme.eui.euiColorVis1,
name: i18n.translate(
'xpack.infra.metricDetailPage.hostMetricsLayout.networkTrafficSection.networkRxRateSeriesLabel',
{
defaultMessage: 'in',
}
),
},
tx: {
color: theme.eui.euiColorVis2,
name: i18n.translate(
'xpack.infra.metricDetailPage.hostMetricsLayout.networkTrafficSection.networkTxRateSeriesLabel',
{
defaultMessage: 'out',
}
),
},
}}
/>
</SubSection>
<SubSection
id="awsEC2DiskIOBytes"
label={i18n.translate(
'xpack.infra.metricDetailPage.ec2MetricsLayout.diskIOBytesSection.sectionLabel',
{
defaultMessage: 'Disk IO (Bytes)',
}
)}
>
<ChartSectionVis
formatter="bytes"
formatterTemplate="{{value}}/s"
type="area"
seriesOverrides={{
write: {
color: theme.eui.euiColorVis2,
name: i18n.translate(
'xpack.infra.metricDetailPage.ec2MetricsLayout.diskIOBytesSection.writeLabel',
{
defaultMessage: 'writes',
}
),
},
read: {
color: theme.eui.euiColorVis1,
name: i18n.translate(
'xpack.infra.metricDetailPage.ec2MetricsLayout.diskIOBytesSection.readLabel',
{
defaultMessage: 'reads',
}
),
},
}}
/>
</SubSection>
</Section>
</React.Fragment>
));
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { cpu } from './snapshot/cpu';
import { rx } from './snapshot/rx';
import { tx } from './snapshot/tx';
import { diskIOReadBytes } from './snapshot/disk_io_read_bytes';
import { diskIOWriteBytes } from './snapshot/disk_io_write_bytes';

import { awsEC2CpuUtilization } from './tsvb/aws_ec2_cpu_utilization';
import { awsEC2NetworkTraffic } from './tsvb/aws_ec2_network_traffic';
import { awsEC2DiskIOBytes } from './tsvb/aws_ec2_diskio_bytes';

import { InventoryMetrics } from '../../types';

export const metrics: InventoryMetrics = {
tsvb: {
awsEC2CpuUtilization,
awsEC2NetworkTraffic,
awsEC2DiskIOBytes,
},
snapshot: { cpu, rx, tx, diskIOReadBytes, diskIOWriteBytes },
defaultSnapshot: 'cpu',
defaultTimeRangeInSeconds: 14400, // 4 hours
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { SnapshotModel } from '../../../types';

export const cpu: SnapshotModel = {
cpu_avg: {
avg: {
field: 'aws.ec2.cpu.total.pct',
},
},
cpu: {
bucket_script: {
buckets_path: {
cpu: 'cpu_avg',
},
script: {
source: 'params.cpu / 100',
lang: 'painless',
},
gap_policy: 'skip',
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { SnapshotModel } from '../../../types';

export const diskIOReadBytes: SnapshotModel = {
diskIOReadBytes: {
avg: {
field: 'aws.ec2.diskio.read.bytes_per_sec',
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { SnapshotModel } from '../../../types';

export const diskIOWriteBytes: SnapshotModel = {
diskIOWriteBytes: {
avg: {
field: 'aws.ec2.diskio.write.bytes_per_sec',
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { SnapshotModel } from '../../../types';

export const rx: SnapshotModel = {
rx: {
avg: {
field: 'aws.ec2.network.in.bytes_per_sec',
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { SnapshotModel } from '../../../types';

export const tx: SnapshotModel = {
tx: {
avg: {
field: 'aws.ec2.network.in.bytes_per_sec',
},
},
};
Loading