Simplify metrics loading in the overview page since we load all metrics anyways

This commit is contained in:
Oleksiy Kovyrin 2021-10-12 17:15:55 -04:00
parent 548a2a562f
commit 4bd67ab88a
2 changed files with 4 additions and 13 deletions

View file

@ -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',
];

View file

@ -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, [], {