From 4bd67ab88a26696e6940d0807fbe7c68a6a52770 Mon Sep 17 00:00:00 2001 From: Oleksiy Kovyrin Date: Tue, 12 Oct 2021 17:15:55 -0400 Subject: [PATCH] Simplify metrics loading in the overview page since we load all metrics anyways --- .../api/v1/enterprise_search/metric_set_overview.js | 12 ------------ .../routes/api/v1/enterprise_search/overview.js | 5 ++++- 2 files changed, 4 insertions(+), 13 deletions(-) delete mode 100644 x-pack/plugins/monitoring/server/routes/api/v1/enterprise_search/metric_set_overview.js diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/enterprise_search/metric_set_overview.js b/x-pack/plugins/monitoring/server/routes/api/v1/enterprise_search/metric_set_overview.js deleted file mode 100644 index 2acca2498be60..0000000000000 --- a/x-pack/plugins/monitoring/server/routes/api/v1/enterprise_search/metric_set_overview.js +++ /dev/null @@ -1,12 +0,0 @@ -/* - * 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. - */ - -export const metricSet = [ - 'app_search_total_engines', - 'workplace_search_total_org_sources', - 'workplace_search_total_private_sources', -]; diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/enterprise_search/overview.js b/x-pack/plugins/monitoring/server/routes/api/v1/enterprise_search/overview.js index b9bc0f49bc99d..39ecb8d7d7ab2 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/enterprise_search/overview.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/enterprise_search/overview.js @@ -8,10 +8,10 @@ import { schema } from '@kbn/config-schema'; import { prefixIndexPattern } from '../../../../../common/ccs_utils'; import { getMetrics } from '../../../../lib/details/get_metrics'; -import { metricSet } from './metric_set_overview'; import { handleError } from '../../../../lib/errors'; import { INDEX_PATTERN_ENTERPRISE_SEARCH } from '../../../../../common/constants'; import { getStats } from '../../../../lib/enterprise_search'; +import { metrics as entSearchMetrics } from '../../../../lib/metrics/enterprise_search/metrics'; export function entSearchOverviewRoute(server) { server.route({ @@ -41,6 +41,9 @@ export function entSearchOverviewRoute(server) { ); try { + // We use all the metrics on the overview page + const metricSet = Object.keys(entSearchMetrics); + const [stats, metrics] = await Promise.all([ getStats(req, entSearchIndexPattern, clusterUuid), getMetrics(req, entSearchIndexPattern, metricSet, [], {