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

[7.x] [Infra UI] Fix section mapping bug in node detail page (#41641) #41711

Merged
merged 1 commit into from
Jul 23, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions x-pack/legacy/plugins/infra/common/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ export enum InfraMetric {
nginxRequestRate = 'nginxRequestRate',
nginxActiveConnections = 'nginxActiveConnections',
nginxRequestsPerConnection = 'nginxRequestsPerConnection',
custom = 'custom',
}

// ====================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2383,7 +2383,8 @@
"description": "",
"isDeprecated": false,
"deprecationReason": null
}
},
{ "name": "custom", "description": "", "isDeprecated": false, "deprecationReason": null }
],
"possibleTypes": null
},
Expand Down
1 change: 1 addition & 0 deletions x-pack/legacy/plugins/infra/public/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ export enum InfraMetric {
nginxRequestRate = 'nginxRequestRate',
nginxActiveConnections = 'nginxActiveConnections',
nginxRequestsPerConnection = 'nginxRequestsPerConnection',
custom = 'custom',
}

// ====================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const metricsSchema: any = gql`
nginxRequestRate
nginxActiveConnections
nginxRequestsPerConnection
custom
}

type InfraMetricData {
Expand Down
1 change: 1 addition & 0 deletions x-pack/legacy/plugins/infra/server/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ export enum InfraMetric {
nginxRequestRate = 'nginxRequestRate',
nginxActiveConnections = 'nginxActiveConnections',
nginxRequestsPerConnection = 'nginxRequestsPerConnection',
custom = 'custom',
}

// ====================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ export interface InfraMetricsAdapter {
): Promise<InfraMetricData[]>;
}

export enum InfraMetricModelQueryType {
lucene = 'lucene',
kuery = 'kuery',
}

export enum InfraMetricModelMetricType {
avg = 'avg',
max = 'max',
Expand All @@ -42,7 +47,7 @@ export enum InfraMetricModelMetricType {
}

export interface InfraMetricModel {
id: string;
id: InfraMetric;
requires: string[];
index_pattern: string | string[];
interval: string;
Expand All @@ -60,7 +65,7 @@ export interface InfraMetricModelSeries {
terms_field?: string;
terms_size?: number;
terms_order_by?: string;
filter?: string;
filter?: { query: string; language: InfraMetricModelQueryType };
}

export interface InfraMetricModelBasicMetric {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ export class KibanaMetricsAdapter implements InfraMetricsAdapter {

const requests = options.metrics.map(metricId => {
const model = metricModels[metricId](timeField, indexPattern, interval);
const filters = [{ match: { [nodeField]: options.nodeId } }];
const filters = model.map_field_to
? [{ match: { [model.map_field_to]: options.nodeId } }]
: [{ match: { [nodeField]: options.nodeId } }];
return this.framework.makeTSVBRequest(req, model, timerange, filters);
});
return Promise.all(requests)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
*/

import { InfraMetricModelCreator, InfraMetricModelMetricType } from '../../adapter_types';
import { InfraMetric } from '../../../../../graphql/types';

export const containerCpuKernel: InfraMetricModelCreator = (timeField, indexPattern, interval) => ({
id: 'containerCpuKernel',
id: InfraMetric.containerCpuKernel,
requires: ['docker.cpu'],
index_pattern: indexPattern,
interval,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
*/

import { InfraMetricModelCreator, InfraMetricModelMetricType } from '../../adapter_types';
import { InfraMetric } from '../../../../../graphql/types';

export const containerCpuUsage: InfraMetricModelCreator = (timeField, indexPattern, interval) => ({
id: 'containerCpuUsage',
id: InfraMetric.containerCpuUsage,
requires: ['docker.cpu'],
index_pattern: indexPattern,
interval,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
*/

import { InfraMetricModelCreator, InfraMetricModelMetricType } from '../../adapter_types';
import { InfraMetric } from '../../../../../graphql/types';

export const containerDiskIOBytes: InfraMetricModelCreator = (
timeField,
indexPattern,
interval
) => ({
id: 'containerDiskIOBytes',
id: InfraMetric.containerDiskIOBytes,
requires: ['docker.disk'],
index_pattern: indexPattern,
interval,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
*/

import { InfraMetricModelCreator, InfraMetricModelMetricType } from '../../adapter_types';
import { InfraMetric } from '../../../../../graphql/types';

export const containerDiskIOOps: InfraMetricModelCreator = (timeField, indexPattern, interval) => ({
id: 'containerDiskIOOps',
id: InfraMetric.containerDiskIOOps,
requires: ['docker.disk'],
index_pattern: indexPattern,
interval,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
*/

import { InfraMetricModelCreator, InfraMetricModelMetricType } from '../../adapter_types';
import { InfraMetric } from '../../../../../graphql/types';

export const containerMemory: InfraMetricModelCreator = (timeField, indexPattern, interval) => ({
id: 'containerMemory',
id: InfraMetric.containerMemory,
requires: ['docker.memory'],
index_pattern: indexPattern,
interval,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
*/

import { InfraMetricModelCreator, InfraMetricModelMetricType } from '../../adapter_types';
import { InfraMetric } from '../../../../../graphql/types';

export const containerNetworkTraffic: InfraMetricModelCreator = (
timeField,
indexPattern,
interval
) => ({
id: 'containerNetworkTraffic',
id: InfraMetric.containerNetworkTraffic,
requires: ['docker.network'],
index_pattern: indexPattern,
interval,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
*/

import { InfraMetricModelCreator, InfraMetricModelMetricType } from '../../adapter_types';
import { InfraMetric } from '../../../../../graphql/types';

export const containerOverview: InfraMetricModelCreator = (timeField, indexPattern, interval) => ({
id: 'containerOverview',
id: InfraMetric.containerOverview,
requires: ['docker'],
index_pattern: indexPattern,
interval,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import {
InfraMetricModelMetricType,
InfraMetricModel,
} from '../../adapter_types';
import { InfraMetric } from '../../../../../graphql/types';

export const hostCpuUsage: InfraMetricModelCreator = (
timeField,
indexPattern,
interval
): InfraMetricModel => ({
id: 'hostCpuUsage',
id: InfraMetric.hostCpuUsage,
requires: ['system.cpu'],
index_pattern: indexPattern,
interval,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import {
InfraMetricModelMetricType,
InfraMetricModel,
} from '../../adapter_types';
import { InfraMetric } from '../../../../../graphql/types';

export const hostFilesystem: InfraMetricModelCreator = (
timeField,
indexPattern,
interval
): InfraMetricModel => ({
id: 'hostFilesystem',
id: InfraMetric.hostFilesystem,
requires: ['system.filesystem'],
filter: 'system.filesystem.device_name:\\/*',
index_pattern: indexPattern,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import {
InfraMetricModelMetricType,
InfraMetricModel,
} from '../../adapter_types';
import { InfraMetric } from '../../../../../graphql/types';

export const hostK8sCpuCap: InfraMetricModelCreator = (
timeField,
indexPattern,
interval
): InfraMetricModel => ({
id: 'hostK8sCpuCap',
id: InfraMetric.hostK8sCpuCap,
map_field_to: 'kubernetes.node.name',
requires: ['kubernetes.node'],
index_pattern: indexPattern,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import {
InfraMetricModelMetricType,
InfraMetricModel,
} from '../../adapter_types';
import { InfraMetric } from '../../../../../graphql/types';

export const hostK8sDiskCap: InfraMetricModelCreator = (
timeField,
indexPattern,
interval
): InfraMetricModel => ({
id: 'hostK8sDiskCap',
id: InfraMetric.hostK8sDiskCap,
map_field_to: 'kubernetes.node.name',
requires: ['kubernetes.node'],
index_pattern: indexPattern,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import {
InfraMetricModelMetricType,
InfraMetricModel,
} from '../../adapter_types';
import { InfraMetric } from '../../../../../graphql/types';

export const hostK8sMemoryCap: InfraMetricModelCreator = (
timeField,
indexPattern,
interval
): InfraMetricModel => ({
id: 'hostK8sMemoryCap',
id: InfraMetric.hostK8sMemoryCap,
map_field_to: 'kubernetes.node.name',
requires: ['kubernetes.node'],
index_pattern: indexPattern,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import {
InfraMetricModelMetricType,
InfraMetricModel,
} from '../../adapter_types';
import { InfraMetric } from '../../../../../graphql/types';

export const hostK8sOverview: InfraMetricModelCreator = (
timeField,
indexPattern,
interval
): InfraMetricModel => ({
id: 'hostK8sOverview',
id: InfraMetric.hostK8sOverview,
requires: ['kubernetes'],
index_pattern: indexPattern,
interval,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import {
InfraMetricModelMetricType,
InfraMetricModel,
} from '../../adapter_types';
import { InfraMetric } from '../../../../../graphql/types';

export const hostK8sPodCap: InfraMetricModelCreator = (
timeField,
indexPattern,
interval
): InfraMetricModel => ({
id: 'hostK8sPodCap',
id: InfraMetric.hostK8sPodCap,
requires: ['kubernetes.node'],
map_field_to: 'kubernetes.node.name',
index_pattern: indexPattern,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import {
InfraMetricModelMetricType,
InfraMetricModel,
} from '../../adapter_types';
import { InfraMetric } from '../../../../../graphql/types';

export const hostLoad: InfraMetricModelCreator = (
timeField,
indexPattern,
interval
): InfraMetricModel => ({
id: 'hostLoad',
id: InfraMetric.hostLoad,
requires: ['system.cpu'],
index_pattern: indexPattern,
interval,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import {
InfraMetricModelMetricType,
InfraMetricModel,
} from '../../adapter_types';
import { InfraMetric } from '../../../../../graphql/types';

export const hostMemoryUsage: InfraMetricModelCreator = (
timeField,
indexPattern,
interval
): InfraMetricModel => ({
id: 'hostMemoryUsage',
id: InfraMetric.hostMemoryUsage,
requires: ['system.memory'],
index_pattern: indexPattern,
interval,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import {
InfraMetricModelMetricType,
InfraMetricModel,
} from '../../adapter_types';
import { InfraMetric } from '../../../../../graphql/types';

export const hostNetworkTraffic: InfraMetricModelCreator = (
timeField,
indexPattern,
interval
): InfraMetricModel => ({
id: 'hostNetworkTraffic',
id: InfraMetric.hostNetworkTraffic,
requires: ['system.network'],
index_pattern: indexPattern,
interval,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import {
InfraMetricModelMetricType,
InfraMetricModel,
} from '../../adapter_types';
import { InfraMetric } from '../../../../../graphql/types';

export const hostSystemOverview: InfraMetricModelCreator = (
timeField,
indexPattern,
interval
): InfraMetricModel => ({
id: 'hostSystemOverview',
id: InfraMetric.hostSystemOverview,
requires: ['system.cpu', 'system.memory', 'system.load', 'system.network'],
index_pattern: indexPattern,
interval,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import {
InfraMetricModelMetricType,
InfraMetricModel,
} from '../../adapter_types';
import { InfraMetric } from '../../../../../graphql/types';

export const nginxActiveConnections: InfraMetricModelCreator = (
timeField,
indexPattern,
interval
): InfraMetricModel => ({
id: 'nginxActiveConnections',
id: InfraMetric.nginxActiveConnections,
requires: ['nginx.stubstatus'],
index_pattern: indexPattern,
interval,
Expand Down
Loading