Skip to content

Commit

Permalink
[Stack Monitoring] separate out mb and legacy index patterns from req…
Browse files Browse the repository at this point in the history
…uests (elastic#120841)

* seprate out mb and legacy index patterns from requests

* use config for metricbeat index
  • Loading branch information
neptunian authored and TinLe committed Dec 22, 2021
1 parent 1d49463 commit 59d8b8f
Show file tree
Hide file tree
Showing 2 changed files with 26 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,19 @@ 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,
config.get('monitoring.ui.metricbeat.index'),
ccs,
true
);

const filebeatIndexPattern = prefixIndexPattern(
config,
config.get('monitoring.ui.logs.index'),
Expand All @@ -54,7 +67,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 59d8b8f

Please sign in to comment.