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

[Infra UI] Add AWS metrics to node detail page #42153

Merged
merged 22 commits into from
Aug 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
15 changes: 14 additions & 1 deletion x-pack/legacy/plugins/infra/common/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,12 @@ export interface InfraSnapshotMetricInput {
/** The type of metric */
type: InfraSnapshotMetricType;
}

export interface InfraNodeIdsInput {
nodeId: string;

cloudId?: string | null;
}
/** The properties to update the source with */
export interface UpdateSourceInput {
/** The name of the data source */
Expand Down Expand Up @@ -493,7 +499,7 @@ export interface SnapshotInfraSourceArgs {
filterQuery?: string | null;
}
export interface MetricsInfraSourceArgs {
nodeId: string;
nodeIds: InfraNodeIdsInput;

nodeType: InfraNodeType;

Expand Down Expand Up @@ -582,6 +588,12 @@ export enum InfraMetric {
nginxRequestRate = 'nginxRequestRate',
nginxActiveConnections = 'nginxActiveConnections',
nginxRequestsPerConnection = 'nginxRequestsPerConnection',
awsOverview = 'awsOverview',
awsCpuUtilization = 'awsCpuUtilization',
awsNetworkBytes = 'awsNetworkBytes',
awsNetworkPackets = 'awsNetworkPackets',
awsDiskioBytes = 'awsDiskioBytes',
awsDiskioOps = 'awsDiskioOps',
custom = 'custom',
}

Expand Down Expand Up @@ -794,6 +806,7 @@ export namespace MetricsQuery {
timerange: InfraTimerangeInput;
metrics: InfraMetric[];
nodeId: string;
cloudId?: string | null;
nodeType: InfraNodeType;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,12 @@ export function useMetadata(
filteredLayouts: (response && getFilteredLayouts(layouts, response.features)) || [],
error: (error && error.message) || null,
loading,
cloudId:
(response &&
response.info &&
response.info.cloud &&
response.info.cloud.instance &&
response.info.cloud.instance.id) ||
'',
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ export const metricsQuery = gql`
$timerange: InfraTimerangeInput!
$metrics: [InfraMetric!]!
$nodeId: ID!
$cloudId: ID
$nodeType: InfraNodeType!
) {
source(id: $sourceId) {
id
metrics(nodeId: $nodeId, timerange: $timerange, metrics: $metrics, nodeType: $nodeType) {
metrics(
nodeIds: { nodeId: $nodeId, cloudId: $cloudId }
timerange: $timerange
metrics: $metrics
nodeType: $nodeType
) {
id
series {
id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ interface WithMetricsProps {
layouts: InfraMetricLayout[];
nodeType: InfraNodeType;
nodeId: string;
cloudId: string;
sourceId: string;
timerange: InfraTimerangeInput;
}
Expand All @@ -39,6 +40,7 @@ export const WithMetrics = ({
timerange,
nodeType,
nodeId,
cloudId,
}: WithMetricsProps) => {
const metrics = layouts.reduce(
(acc, item) => {
Expand All @@ -57,6 +59,7 @@ export const WithMetrics = ({
metrics,
nodeType,
nodeId,
cloudId,
timerange,
}}
>
Expand Down
67 changes: 65 additions & 2 deletions x-pack/legacy/plugins/infra/public/graphql/introspection.json
Original file line number Diff line number Diff line change
Expand Up @@ -471,12 +471,12 @@
"description": "",
"args": [
{
"name": "nodeId",
"name": "nodeIds",
"description": "",
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": { "kind": "SCALAR", "name": "ID", "ofType": null }
"ofType": { "kind": "INPUT_OBJECT", "name": "InfraNodeIdsInput", "ofType": null }
},
"defaultValue": null
},
Expand Down Expand Up @@ -2316,6 +2316,33 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "INPUT_OBJECT",
"name": "InfraNodeIdsInput",
"description": "",
"fields": null,
"inputFields": [
{
"name": "nodeId",
"description": "",
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": { "kind": "SCALAR", "name": "ID", "ofType": null }
},
"defaultValue": null
},
{
"name": "cloudId",
"description": "",
"type": { "kind": "SCALAR", "name": "ID", "ofType": null },
"defaultValue": null
}
],
"interfaces": null,
"enumValues": null,
"possibleTypes": null
},
{
"kind": "ENUM",
"name": "InfraMetric",
Expand Down Expand Up @@ -2486,6 +2513,42 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "awsOverview",
"description": "",
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "awsCpuUtilization",
"description": "",
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "awsNetworkBytes",
"description": "",
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "awsNetworkPackets",
"description": "",
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "awsDiskioBytes",
"description": "",
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "awsDiskioOps",
"description": "",
"isDeprecated": false,
"deprecationReason": null
},
{ "name": "custom", "description": "", "isDeprecated": false, "deprecationReason": null }
],
"possibleTypes": null
Expand Down
15 changes: 14 additions & 1 deletion x-pack/legacy/plugins/infra/public/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,12 @@ export interface InfraSnapshotMetricInput {
/** The type of metric */
type: InfraSnapshotMetricType;
}

export interface InfraNodeIdsInput {
nodeId: string;

cloudId?: string | null;
}
/** The properties to update the source with */
export interface UpdateSourceInput {
/** The name of the data source */
Expand Down Expand Up @@ -493,7 +499,7 @@ export interface SnapshotInfraSourceArgs {
filterQuery?: string | null;
}
export interface MetricsInfraSourceArgs {
nodeId: string;
nodeIds: InfraNodeIdsInput;

nodeType: InfraNodeType;

Expand Down Expand Up @@ -582,6 +588,12 @@ export enum InfraMetric {
nginxRequestRate = 'nginxRequestRate',
nginxActiveConnections = 'nginxActiveConnections',
nginxRequestsPerConnection = 'nginxRequestsPerConnection',
awsOverview = 'awsOverview',
awsCpuUtilization = 'awsCpuUtilization',
awsNetworkBytes = 'awsNetworkBytes',
awsNetworkPackets = 'awsNetworkPackets',
awsDiskioBytes = 'awsDiskioBytes',
awsDiskioOps = 'awsDiskioOps',
custom = 'custom',
}

Expand Down Expand Up @@ -794,6 +806,7 @@ export namespace MetricsQuery {
timerange: InfraTimerangeInput;
metrics: InfraMetric[];
nodeId: string;
cloudId?: string | null;
nodeType: InfraNodeType;
};

Expand Down
3 changes: 2 additions & 1 deletion x-pack/legacy/plugins/infra/public/pages/metrics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const MetricDetail = withMetricPageProviders(
}
const { sourceId } = useContext(Source.Context);
const layouts = layoutCreator(theme);
const { name, filteredLayouts, loading: metadataLoading } = useMetadata(
const { name, filteredLayouts, loading: metadataLoading, cloudId } = useMetadata(
nodeId,
nodeType,
layouts,
Expand Down Expand Up @@ -148,6 +148,7 @@ export const MetricDetail = withMetricPageProviders(
timerange={timeRange as InfraTimerangeInput}
nodeType={nodeType}
nodeId={nodeId}
cloudId={cloudId}
>
{({ metrics, error, loading, refetch }) => {
if (error) {
Expand Down
Loading