Skip to content

Commit

Permalink
seprate out mb and legacy index patterns from requests
Browse files Browse the repository at this point in the history
  • Loading branch information
neptunian committed Dec 8, 2021
1 parent 366ccf5 commit b540506
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ export function handleMbLastRecoveries(resp: ElasticsearchResponse, start: numbe
return filtered;
}

export async function getLastRecovery(req: LegacyRequest, esIndexPattern: string, size: number) {
export async function getLastRecovery(
req: LegacyRequest,
esIndexPattern: string,
mbIndexPattern: string,
size: number
) {
checkParam(esIndexPattern, 'esIndexPattern in elasticsearch/getLastRecovery');

const start = req.payload.timeRange.min;
Expand All @@ -105,7 +110,7 @@ export async function getLastRecovery(req: LegacyRequest, esIndexPattern: string
},
};
const mbParams = {
index: esIndexPattern,
index: mbIndexPattern,
size,
ignore_unavailable: true,
body: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ export function esOverviewRoute(server) {
const ccs = req.payload.ccs;
const clusterUuid = req.params.clusterUuid;
const esIndexPattern = prefixIndexPattern(config, INDEX_PATTERN_ELASTICSEARCH, ccs);
const esLegacyIndexPattern = prefixIndexPattern(
config,
INDEX_PATTERN_ELASTICSEARCH,
ccs,
true
);
const mbIndexPattern = prefixIndexPattern(config, 'metricbeat-*', ccs, true);

const filebeatIndexPattern = prefixIndexPattern(
config,
config.get('monitoring.ui.logs.index'),
Expand All @@ -54,7 +62,12 @@ export function esOverviewRoute(server) {
const [clusterStats, metrics, shardActivity, logs] = await Promise.all([
getClusterStats(req, esIndexPattern, clusterUuid),
getMetrics(req, esIndexPattern, metricSet),
getLastRecovery(req, esIndexPattern, config.get('monitoring.ui.max_bucket_size')),
getLastRecovery(
req,
esLegacyIndexPattern,
mbIndexPattern,
config.get('monitoring.ui.max_bucket_size')
),
getLogs(config, req, filebeatIndexPattern, { clusterUuid, start, end }),
]);
const indicesUnassignedShardStats = await getIndicesUnassignedShardStats(
Expand Down

0 comments on commit b540506

Please sign in to comment.