Skip to content

Commit

Permalink
Reverts back to using callCluster to get the cluster info in stats route
Browse files Browse the repository at this point in the history
  • Loading branch information
TinaHeiligers committed Sep 23, 2020
1 parent ce3a9a0 commit 12ca461
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/plugins/usage_collection/server/routes/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@ export function registerStatsRoute({
return collectorSet.toObject(usage);
};

const getClusterUuid = async (esClient: ElasticsearchClient): Promise<string> => {
const result = await esClient.info<{ cluster_uuid: string }>();
const { cluster_uuid: uuid } = result.body;
const getClusterUuid = async (callCluster: LegacyAPICaller): Promise<string> => {
const { cluster_uuid: uuid } = await callCluster('info', { filterPath: 'cluster_uuid' });
return uuid;
};

Expand Down Expand Up @@ -109,7 +108,7 @@ export function registerStatsRoute({
}

const usagePromise = shouldGetUsage ? getUsage(callCluster, esClient) : Promise.resolve({});
const [usage, clusterUuid] = await Promise.all([usagePromise, getClusterUuid(esClient)]);
const [usage, clusterUuid] = await Promise.all([usagePromise, getClusterUuid(callCluster)]);

let modifiedUsage = usage;
if (isLegacy) {
Expand Down

0 comments on commit 12ca461

Please sign in to comment.