From aa1cb4e9313d6c476d9d2192b2e36c54a828e125 Mon Sep 17 00:00:00 2001 From: Mike Place Date: Thu, 19 Sep 2019 09:57:55 +0000 Subject: [PATCH] [Stack Monitoring] Add I/O metrics for Elasticsearch (#45870) * I/O metrics POC * Gather correct metric for total * Remove io stats from advanced * Move io stats to node overview page * Add new io metrics * Add new io metrics * Add note about supported platforms * Update snapshot * Add warning about platforms to all metrics * Another snapshot update * Update type and units * Remove errant trailing comma * Snapshot update for new types * Add node_io integration testing --- .../components/elasticsearch/node/node.js | 1 + .../__snapshots__/metrics.test.js.snap | 42 +++++++++++++ .../lib/metrics/elasticsearch/metrics.js | 45 ++++++++++++++ .../elasticsearch/metric_set_node_detail.js | 6 +- .../elasticsearch/fixtures/node_detail.json | 60 +++++++++++++++++++ 5 files changed, 153 insertions(+), 1 deletion(-) diff --git a/x-pack/legacy/plugins/monitoring/public/components/elasticsearch/node/node.js b/x-pack/legacy/plugins/monitoring/public/components/elasticsearch/node/node.js index d58b67283ab05..bda6c51e9000e 100644 --- a/x-pack/legacy/plugins/monitoring/public/components/elasticsearch/node/node.js +++ b/x-pack/legacy/plugins/monitoring/public/components/elasticsearch/node/node.js @@ -32,6 +32,7 @@ export const Node = ({ const metricsToShow = [ metrics.node_jvm_mem, metrics.node_mem, + metrics.node_total_io, metrics.node_cpu_metric, metrics.node_load_average, metrics.node_latency, diff --git a/x-pack/legacy/plugins/monitoring/server/lib/metrics/__test__/__snapshots__/metrics.test.js.snap b/x-pack/legacy/plugins/monitoring/server/lib/metrics/__test__/__snapshots__/metrics.test.js.snap index 78b6b24280548..96223fe6e37c6 100644 --- a/x-pack/legacy/plugins/monitoring/server/lib/metrics/__test__/__snapshots__/metrics.test.js.snap +++ b/x-pack/legacy/plugins/monitoring/server/lib/metrics/__test__/__snapshots__/metrics.test.js.snap @@ -4600,6 +4600,48 @@ Object { "units": "ms", "uuidField": "source_node.uuid", }, + "node_total_cumul_io": RequestRateMetric { + "app": "elasticsearch", + "derivative": true, + "description": "Total I/O. (This metric is not supported on all platforms and may display N/A if I/O data is unavailable.)", + "field": "node_stats.fs.io_stats.total.operations", + "format": "0,0.[00]", + "label": "Total I/O", + "metricAgg": "max", + "timestampField": "timestamp", + "title": "I/O Operations Rate", + "type": "node", + "units": "/s", + "uuidField": "source_node.uuid", + }, + "node_total_read_io": RequestRateMetric { + "app": "elasticsearch", + "derivative": true, + "description": "Total Read I/O. (This metric is not supported on all platforms and may display N/A if I/O data is unavailable.)", + "field": "node_stats.fs.io_stats.total.read_operations", + "format": "0,0.[00]", + "label": "Total Read I/O", + "metricAgg": "max", + "timestampField": "timestamp", + "title": "I/O Operations Rate", + "type": "node", + "units": "/s", + "uuidField": "source_node.uuid", + }, + "node_total_write_io": RequestRateMetric { + "app": "elasticsearch", + "derivative": true, + "description": "Total Write I/O. (This metric is not supported on all platforms and may display N/A if I/O data is unavailable.)", + "field": "node_stats.fs.io_stats.total.write_operations", + "format": "0,0.[00]", + "label": "Total Write I/O", + "metricAgg": "max", + "timestampField": "timestamp", + "title": "I/O Operations Rate", + "type": "node", + "units": "/s", + "uuidField": "source_node.uuid", + }, "search_request_rate": RequestRateMetric { "app": "elasticsearch", "derivative": true, diff --git a/x-pack/legacy/plugins/monitoring/server/lib/metrics/elasticsearch/metrics.js b/x-pack/legacy/plugins/monitoring/server/lib/metrics/elasticsearch/metrics.js index 1cf8fd939086d..5df5674dea12a 100644 --- a/x-pack/legacy/plugins/monitoring/server/lib/metrics/elasticsearch/metrics.js +++ b/x-pack/legacy/plugins/monitoring/server/lib/metrics/elasticsearch/metrics.js @@ -40,6 +40,9 @@ const indexRequestTimeTitle = i18n.translate('xpack.monitoring.metrics.esIndex.r const indexIndexingRateTitle = i18n.translate('xpack.monitoring.metrics.esIndex.indexingRateTitle', { defaultMessage: 'Indexing Rate' }); +const nodeIoRateTitle = i18n.translate('xpack.monitoring.metrics.esNode.ioRateTitle', { + defaultMessage: 'I/O Operations Rate' +}); const indexSegmentCountTitle = i18n.translate('xpack.monitoring.metrics.esIndex.segmentCountTitle', { defaultMessage: 'Segment Count' }); @@ -425,6 +428,48 @@ export const metrics = { defaultMessage: 'Heap memory used by the Index Writer. This is NOT a part of Lucene Total.' }) }), + node_total_cumul_io: new RequestRateMetric({ + field: 'node_stats.fs.io_stats.total.operations', + title: nodeIoRateTitle, + format: LARGE_FLOAT, + units: 'ops', + type: 'node', + derivative: true, + label: i18n.translate('xpack.monitoring.metrics.esNode.totalIoLabel', { + defaultMessage: 'Total I/O' + }), + description: i18n.translate('xpack.monitoring.metrics.esNode.totalIoDescription', { + defaultMessage: 'Total I/O. (This metric is not supported on all platforms and may display N/A if I/O data is unavailable.)' + }) + }), + node_total_read_io: new RequestRateMetric({ + field: 'node_stats.fs.io_stats.total.read_operations', + title: nodeIoRateTitle, + format: LARGE_FLOAT, + units: 'ops', + type: 'node', + derivative: true, + label: i18n.translate('xpack.monitoring.metrics.esNode.totalIoReadLabel', { + defaultMessage: 'Total Read I/O' + }), + description: i18n.translate('xpack.monitoring.metrics.esNode.totalIoReadDescription', { + defaultMessage: 'Total Read I/O. (This metric is not supported on all platforms and may display N/A if I/O data is unavailable.)' + }) + }), + node_total_write_io: new RequestRateMetric({ + field: 'node_stats.fs.io_stats.total.write_operations', + title: nodeIoRateTitle, + format: LARGE_FLOAT, + units: 'ops', + type: 'node', + derivative: true, + label: i18n.translate('xpack.monitoring.metrics.esNode.totalIoWriteLabel', { + defaultMessage: 'Total Write I/O' + }), + description: i18n.translate('xpack.monitoring.metrics.esNode.totalIoWriteDescription', { + defaultMessage: 'Total Write I/O. (This metric is not supported on all platforms and may display N/A if I/O data is unavailable.)' + }) + }), index_request_rate_primary: new ElasticsearchMetric({ field: 'index_stats.primaries.indexing.index_total', title: indexIndexingRateTitle, diff --git a/x-pack/legacy/plugins/monitoring/server/routes/api/v1/elasticsearch/metric_set_node_detail.js b/x-pack/legacy/plugins/monitoring/server/routes/api/v1/elasticsearch/metric_set_node_detail.js index b6322bb67f047..f99cf9fac3d0d 100644 --- a/x-pack/legacy/plugins/monitoring/server/routes/api/v1/elasticsearch/metric_set_node_detail.js +++ b/x-pack/legacy/plugins/monitoring/server/routes/api/v1/elasticsearch/metric_set_node_detail.js @@ -92,9 +92,13 @@ export const metricSets = { { keys: ['node_query_latency', 'node_index_latency'], name: 'node_latency' - } + }, ], overview: [ + { + keys: ['node_total_cumul_io', 'node_total_read_io', 'node_total_write_io'], + name: 'node_total_io', + }, { keys: ['node_query_latency', 'node_index_latency'], name: 'node_latency' diff --git a/x-pack/test/api_integration/apis/monitoring/elasticsearch/fixtures/node_detail.json b/x-pack/test/api_integration/apis/monitoring/elasticsearch/fixtures/node_detail.json index db853337e0539..c2ee3a818fe14 100644 --- a/x-pack/test/api_integration/apis/monitoring/elasticsearch/fixtures/node_detail.json +++ b/x-pack/test/api_integration/apis/monitoring/elasticsearch/fixtures/node_detail.json @@ -179,6 +179,66 @@ "isDerivative": false }, "data": [] + }], + "node_total_io": [{ + "bucket_size": "10 seconds", + "data": [], + "metric": { + "app": "elasticsearch", + "description": "Total I/O. (This metric is not supported on all platforms and may display N/A if I/O data is unavailable.)", + "field": "node_stats.fs.io_stats.total.operations", + "format": "0,0.[00]", + "hasCalculation": false, + "isDerivative": true, + "label": "Total I/O", + "metricAgg": "max", + "title": "I/O Operations Rate", + "units": "/s" + }, + "timeRange": { + "max": 1507235712000, + "min": 1507235508000 + } + }, + { + "bucket_size": "10 seconds", + "data": [], + "metric": { + "app": "elasticsearch", + "description": "Total Read I/O. (This metric is not supported on all platforms and may display N/A if I/O data is unavailable.)", + "field": "node_stats.fs.io_stats.total.read_operations", + "format": "0,0.[00]", + "hasCalculation": false, + "isDerivative": true, + "label": "Total Read I/O", + "metricAgg": "max", + "title": "I/O Operations Rate", + "units": "/s" + }, + "timeRange": { + "max": 1507235712000, + "min": 1507235508000 + } + }, + { + "bucket_size": "10 seconds", + "data": [], + "metric": { + "app": "elasticsearch", + "description": "Total Write I/O. (This metric is not supported on all platforms and may display N/A if I/O data is unavailable.)", + "field": "node_stats.fs.io_stats.total.write_operations", + "format": "0,0.[00]", + "hasCalculation": false, + "isDerivative": true, + "label": "Total Write I/O", + "metricAgg": "max", + "title": "I/O Operations Rate", + "units": "/s" + }, + "timeRange": { + "max": 1507235712000, + "min": 1507235508000 + } }], "node_load_average": [{ "bucket_size": "10 seconds",