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 kubernetes charts to the host detail view #166383

Merged
merged 10 commits into from
Sep 20, 2023
76 changes: 0 additions & 76 deletions x-pack/plugins/infra/public/common/visualizations/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,81 +5,5 @@
* 2.0.
*/

import {
cpuUsage,
cpuUsageIowait,
cpuUsageIrq,
cpuUsageNice,
cpuUsageSoftirq,
cpuUsageSteal,
cpuUsageUser,
cpuUsageSystem,
diskIORead,
diskIOWrite,
diskReadThroughput,
diskWriteThroughput,
diskSpaceAvailability,
diskSpaceAvailable,
diskUsage,
logRate,
normalizedLoad1m,
load1m,
load5m,
load15m,
memoryUsage,
memoryFree,
memoryUsed,
memoryFreeExcludingCache,
memoryCache,
nginxActiveConnections,
nginxRequestRate,
nginxRequestsPerConnection,
nginxSuccessStatusCodes,
nginxRedirectStatusCodes,
nginxClientErrorStatusCodes,
nginxServerErrorStatusCodes,
rx,
tx,
hostCount,
} from './lens/formulas/host';

export const hostLensFormulas = {
cpuUsage,
cpuUsageIowait,
cpuUsageIrq,
cpuUsageNice,
cpuUsageSoftirq,
cpuUsageSteal,
cpuUsageUser,
cpuUsageSystem,
diskIORead,
diskIOWrite,
diskReadThroughput,
diskWriteThroughput,
diskSpaceAvailability,
diskSpaceAvailable,
diskUsage,
hostCount,
logRate,
normalizedLoad1m,
load1m,
load5m,
load15m,
memoryUsage,
memoryFree,
memoryUsed,
memoryFreeExcludingCache,
memoryCache,
nginxActiveConnections,
nginxRequestRate,
nginxRequestsPerConnection,
nginxSuccessStatusCodes,
nginxRedirectStatusCodes,
nginxClientErrorStatusCodes,
nginxServerErrorStatusCodes,
rx,
tx,
};

export const HOST_METRICS_DOC_HREF = 'https://ela.st/docs-infra-host-metrics';
export const HOST_METRICS_DOTTED_LINES_DOC_HREF = 'https://ela.st/docs-infra-why-dotted';
8 changes: 1 addition & 7 deletions x-pack/plugins/infra/public/common/visualizations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,5 @@
* 2.0.
*/

export type {
HostsLensFormulas,
HostsLensMetricChartFormulas,
HostsLensLineChartFormulas,
} from './types';

export * from './lens/dashboards';
export { hostLensFormulas } from './constants';
export * from './lens/formulas';
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { i18n } from '@kbn/i18n';
import type { TypedLensByValueInput } from '@kbn/lens-plugin/public';
import { hostLensFormulas } from '../../../../constants';
import { hostLensFormulas } from '../../../formulas';
import type { MetricChartLayerParams } from '../../../../types';
import { METRICS_TOOLTIP } from '../../translations';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*
* 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 { i18n } from '@kbn/i18n';
import { kubernetesLensFormulas } from '../../../formulas';
import { XY_OVERRIDES } from '../../constants';
import type { XYConfig } from '../metric_charts/types';

export const kubernetesCharts: XYConfig[] = [
{
id: 'nodeCpuCapacity',
title: i18n.translate('xpack.infra.assetDetails.metricsCharts.kubernetes.nodeCpuCapacity', {
defaultMessage: 'Node CPU Capacity',
}),

layers: [
{
data: [kubernetesLensFormulas.nodeCpuCapacity, kubernetesLensFormulas.nodeCpuUsed],
type: 'visualization',
options: {
seriesType: 'area',
},
},
],
dataViewOrigin: 'metrics',
overrides: {
settings: XY_OVERRIDES.settings,
},
},
{
id: 'nodeMemoryCapacity',
title: i18n.translate('xpack.infra.assetDetails.metricsCharts.nginx.nodeMemoryCapacity', {
defaultMessage: 'Node Memory Capacity',
}),

layers: [
{
data: [kubernetesLensFormulas.nodeMemoryCapacity, kubernetesLensFormulas.nodeMemoryUsed],
type: 'visualization',
options: {
seriesType: 'area',
},
},
],
dataViewOrigin: 'metrics',
overrides: {
settings: XY_OVERRIDES.settings,
},
},
{
id: 'nodeDiskCapacity',
title: i18n.translate('xpack.infra.assetDetails.metricsCharts.nginx.nodeDiskCapacity', {
defaultMessage: 'Node Disk Capacity',
}),

layers: [
{
data: [kubernetesLensFormulas.nodeDiskCapacity, kubernetesLensFormulas.nodeDiskUsed],
type: 'visualization',
options: {
seriesType: 'area',
},
},
],
dataViewOrigin: 'metrics',
overrides: {
settings: XY_OVERRIDES.settings,
},
},
{
id: 'nodePodCapacity',
title: i18n.translate('xpack.infra.assetDetails.metricsCharts.nginx.nodePodCapacity', {
defaultMessage: 'Node Pod Capacity',
}),

layers: [
{
data: [kubernetesLensFormulas.nodePodCapacity, kubernetesLensFormulas.nodePodUsed],
type: 'visualization',
options: {
seriesType: 'area',
},
},
],
dataViewOrigin: 'metrics',
overrides: {
settings: XY_OVERRIDES.settings,
},
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,81 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import {
nginxActiveConnections,
nginxRequestRate,
nginxRequestsPerConnection,
nginxResponseStatusCodes,
} from '../metric_charts/nginx';

import { i18n } from '@kbn/i18n';
import { nginxLensFormulas } from '../../../formulas';
import { XY_OVERRIDES } from '../../constants';
import type { XYConfig } from '../metric_charts/types';

export const nginxStubstatusCharts: XYConfig[] = [
nginxActiveConnections,
nginxRequestRate,
nginxRequestsPerConnection,
{
id: 'requestRate',
title: i18n.translate('xpack.infra.assetDetails.metricsCharts.nginx.requestRate', {
defaultMessage: 'Request Rate',
}),

layers: [
{
data: [nginxLensFormulas.requestRate],
type: 'visualization',
},
],
dataViewOrigin: 'metrics',
},
{
id: 'activeConnections',
title: i18n.translate('xpack.infra.assetDetails.metricsCharts.nginx.activeConnections', {
defaultMessage: 'Active Connections',
}),

layers: [
{
data: [nginxLensFormulas.activeConnections],
type: 'visualization',
},
],
dataViewOrigin: 'metrics',
},
{
id: 'requestsPerConnection',
title: i18n.translate('xpack.infra.assetDetails.metricsCharts.nginx.requestsPerConnection', {
defaultMessage: 'Requests Per Connection',
}),

layers: [
{
data: [nginxLensFormulas.requestsPerConnection],
type: 'visualization',
},
],
dataViewOrigin: 'metrics',
},
];

export const nginxAccessCharts: XYConfig[] = [nginxResponseStatusCodes];
export const nginxAccessCharts: XYConfig[] = [
{
id: 'responseStatusCodes',
title: i18n.translate('xpack.infra.assetDetails.metricsCharts.nginx.responseStatusCodes', {
defaultMessage: 'Response Status Codes',
}),

layers: [
{
data: [
nginxLensFormulas.successStatusCodes,
nginxLensFormulas.redirectStatusCodes,
nginxLensFormulas.clientErrorStatusCodes,
nginxLensFormulas.serverErrorStatusCodes,
],
options: {
seriesType: 'area',
},
type: 'visualization',
},
],
overrides: {
settings: XY_OVERRIDES.settings,
},
dataViewOrigin: 'metrics',
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,20 @@
import { hostMetricFlyoutCharts, hostMetricChartsFullPage } from './host/host_metric_charts';
import { hostKPICharts, KPIChartProps } from './host/host_kpi_charts';
import { nginxAccessCharts, nginxStubstatusCharts } from './host/nginx_charts';
import { kubernetesCharts } from './host/kubernetes_charts';

export { type KPIChartProps };
export const assetDetailsDashboards = {
host: { hostMetricFlyoutCharts, hostMetricChartsFullPage, hostKPICharts },
nginx: { nginxStubstatusCharts, nginxAccessCharts },
host: { hostMetricFlyoutCharts, hostMetricChartsFullPage, hostKPICharts, keyField: 'host.name' },
nginx: {
nginxStubstatusCharts,
nginxAccessCharts,
keyField: 'host.name',
dependsOn: ['nginx.stubstatus', 'nginx.access'],
},
kubernetes: {
kubernetesCharts,
keyField: 'kubernetes.node.name',
dependsOn: ['kubernetes.node'],
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { i18n } from '@kbn/i18n';
import { hostLensFormulas } from '../../../../constants';
import { hostLensFormulas } from '../../../formulas';
import { REFERENCE_LINE, XY_OVERRIDES } from '../../constants';
import type { XYConfig } from './types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { i18n } from '@kbn/i18n';
import { hostLensFormulas } from '../../../../constants';
import { hostLensFormulas } from '../../../formulas';
import { XY_OVERRIDES } from '../../constants';
import type { XYConfig } from './types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { i18n } from '@kbn/i18n';
import { hostLensFormulas } from '../../../../constants';
import { hostLensFormulas } from '../../../formulas';
import type { XYConfig } from './types';

export const logRate: XYConfig = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { i18n } from '@kbn/i18n';
import { hostLensFormulas } from '../../../../constants';
import { hostLensFormulas } from '../../../formulas';
import { XY_OVERRIDES } from '../../constants';
import type { XYConfig } from './types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { i18n } from '@kbn/i18n';
import { hostLensFormulas } from '../../../../constants';
import { hostLensFormulas } from '../../../formulas';
import { XY_OVERRIDES } from '../../constants';
import type { XYConfig } from './types';

Expand Down
Loading