From ab472287291a3ac2406cf9c4fc920802e1d55036 Mon Sep 17 00:00:00 2001 From: Gil Raphaelli Date: Mon, 10 Dec 2018 15:14:48 -0500 Subject: [PATCH] add missing apm-server response error monitor (#26570) --- .../__snapshots__/metrics.test.js.snap | 41 +++++++++++++++++++ .../server/lib/metrics/apm/metrics.js | 12 ++++++ .../routes/api/v1/apm/metric_set_instance.js | 1 + .../routes/api/v1/apm/metric_set_overview.js | 1 + .../apis/monitoring/apm/fixtures/cluster.json | 23 +++++++++++ .../monitoring/apm/fixtures/instance.json | 23 +++++++++++ .../es_archives/monitoring/apm/mappings.json | 5 ++- 7 files changed, 105 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/monitoring/server/lib/metrics/__test__/__snapshots__/metrics.test.js.snap b/x-pack/plugins/monitoring/server/lib/metrics/__test__/__snapshots__/metrics.test.js.snap index 72b8a5dadc02..37f293b99a26 100644 --- a/x-pack/plugins/monitoring/server/lib/metrics/__test__/__snapshots__/metrics.test.js.snap +++ b/x-pack/plugins/monitoring/server/lib/metrics/__test__/__snapshots__/metrics.test.js.snap @@ -670,6 +670,47 @@ Object { "units": "/m", "uuidField": "cluster_uuid", }, + "apm_responses_errors_internal": ApmEventsRateClusterMetric { + "aggs": Object { + "beats_uuids": Object { + "aggs": Object { + "event_rate_per_beat": Object { + "max": Object { + "field": "beats_stats.metrics.apm-server.server.response.errors.internal", + }, + }, + }, + "terms": Object { + "field": "beats_stats.beat.uuid", + "size": 10000, + }, + }, + "event_rate": Object { + "sum_bucket": Object { + "buckets_path": "beats_uuids>event_rate_per_beat", + "gap_policy": "skip", + }, + }, + "metric_deriv": Object { + "derivative": Object { + "buckets_path": "event_rate", + "gap_policy": "skip", + "unit": "1m", + }, + }, + }, + "app": "apm", + "derivative": true, + "description": "HTTP Requests rejected due to a miscellaneous internal error", + "field": "beats_stats.metrics.apm-server.server.response.errors.internal", + "format": "0,0.[00]", + "label": "Internal", + "metricAgg": "max", + "timestampField": "beats_stats.timestamp", + "title": "Internal", + "units": "/m", + "uuidField": "cluster_uuid", + }, "apm_responses_errors_method": ApmEventsRateClusterMetric { "aggs": Object { "beats_uuids": Object { diff --git a/x-pack/plugins/monitoring/server/lib/metrics/apm/metrics.js b/x-pack/plugins/monitoring/server/lib/metrics/apm/metrics.js index 3e52c5fc1c65..1103dd120f91 100644 --- a/x-pack/plugins/monitoring/server/lib/metrics/apm/metrics.js +++ b/x-pack/plugins/monitoring/server/lib/metrics/apm/metrics.js @@ -284,6 +284,18 @@ export const metrics = { defaultMessage: 'HTTP Requests rejected during server shutdown' }) }), + apm_responses_errors_internal: new ApmEventsRateClusterMetric({ + field: 'beats_stats.metrics.apm-server.server.response.errors.internal', + title: i18n.translate('xpack.monitoring.metrics.apm.responseErrors.internalTitle', { + defaultMessage: 'Internal' + }), + label: i18n.translate('xpack.monitoring.metrics.apm.responseErrors.internalLabel', { + defaultMessage: 'Internal' + }), + description: i18n.translate('xpack.monitoring.metrics.apm.responseErrors.internalDescription', { + defaultMessage: 'HTTP Requests rejected due to a miscellaneous internal error' + }) + }), apm_processor_transaction_transformations: new ApmEventsRateClusterMetric({ field: 'beats_stats.metrics.apm-server.processor.transaction.transformations', diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_instance.js b/x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_instance.js index a3f7784aee52..9c6738fa647b 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_instance.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_instance.js @@ -59,6 +59,7 @@ export const metricSet = [ 'apm_responses_errors_forbidden', 'apm_responses_errors_concurrency', 'apm_responses_errors_closed', + 'apm_responses_errors_internal', ], name: 'apm_responses_errors' }, diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_overview.js b/x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_overview.js index a3f7784aee52..9c6738fa647b 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_overview.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_overview.js @@ -59,6 +59,7 @@ export const metricSet = [ 'apm_responses_errors_forbidden', 'apm_responses_errors_concurrency', 'apm_responses_errors_closed', + 'apm_responses_errors_internal', ], name: 'apm_responses_errors' }, diff --git a/x-pack/test/api_integration/apis/monitoring/apm/fixtures/cluster.json b/x-pack/test/api_integration/apis/monitoring/apm/fixtures/cluster.json index c2a1cf28d451..edfbdbcddf98 100644 --- a/x-pack/test/api_integration/apis/monitoring/apm/fixtures/cluster.json +++ b/x-pack/test/api_integration/apis/monitoring/apm/fixtures/cluster.json @@ -590,6 +590,29 @@ [1535723910000, 0], [1535723940000, 0] ] + }, { + "bucket_size": "30 seconds", + "timeRange": { + "min": 1535720389104, + "max": 1535723989104 + }, + "metric": { + "app": "apm", + "field": "beats_stats.metrics.apm-server.server.response.errors.internal", + "metricAgg": "max", + "label": "Internal", + "title": "Internal", + "description": "HTTP Requests rejected due to a miscellaneous internal error", + "units": "/m", + "format": "0,0.[00]", + "hasCalculation": false, + "isDerivative": true + }, + "data": [ + [1535723880000, null], + [1535723910000, 0], + [1535723940000, 0] + ] }], "apm_requests": [{ "bucket_size": "30 seconds", diff --git a/x-pack/test/api_integration/apis/monitoring/apm/fixtures/instance.json b/x-pack/test/api_integration/apis/monitoring/apm/fixtures/instance.json index 1fbb3a79cc9c..a3abd884229d 100644 --- a/x-pack/test/api_integration/apis/monitoring/apm/fixtures/instance.json +++ b/x-pack/test/api_integration/apis/monitoring/apm/fixtures/instance.json @@ -581,6 +581,29 @@ [1535723910000, 0], [1535723940000, 0] ] + }, { + "bucket_size": "30 seconds", + "timeRange": { + "min": 1535720389104, + "max": 1535723989104 + }, + "metric": { + "app": "apm", + "field": "beats_stats.metrics.apm-server.server.response.errors.internal", + "metricAgg": "max", + "label": "Internal", + "title": "Internal", + "description": "HTTP Requests rejected due to a miscellaneous internal error", + "units": "/m", + "format": "0,0.[00]", + "hasCalculation": false, + "isDerivative": true + }, + "data": [ + [1535723880000, null], + [1535723910000, 0], + [1535723940000, 0] + ] }], "apm_requests": [{ "bucket_size": "30 seconds", diff --git a/x-pack/test/functional/es_archives/monitoring/apm/mappings.json b/x-pack/test/functional/es_archives/monitoring/apm/mappings.json index 1b3d57dcf297..16a8c8387274 100644 --- a/x-pack/test/functional/es_archives/monitoring/apm/mappings.json +++ b/x-pack/test/functional/es_archives/monitoring/apm/mappings.json @@ -387,6 +387,9 @@ }, "validate": { "type": "long" + }, + "internal": { + "type": "long" } } }, @@ -685,4 +688,4 @@ }, "aliases": {} } -} \ No newline at end of file +}