[ML] Fix audit messages. (#27575)
This commit is contained in:
parent
973fad3b0a
commit
7971b15cec
2 changed files with 7 additions and 2 deletions
|
@ -103,7 +103,11 @@ export function jobAuditMessagesProvider(callWithRequest) {
|
|||
}
|
||||
|
||||
// search highest, most recent audit messages for all jobs for the last 24hrs.
|
||||
async function getAuditMessagesSummary() {
|
||||
async function getAuditMessagesSummary(jobAggregationSize = 10) {
|
||||
// TODO This is the current default value of the cluster setting `search.max_buckets`.
|
||||
// This should possibly consider the real settings in a future update.
|
||||
const maxBuckets = 10000;
|
||||
|
||||
try {
|
||||
const resp = await callWithRequest('search', {
|
||||
index: ML_NOTIFICATION_INDEX_PATTERN,
|
||||
|
@ -126,6 +130,7 @@ export function jobAuditMessagesProvider(callWithRequest) {
|
|||
levelsPerJob: {
|
||||
terms: {
|
||||
field: 'job_id',
|
||||
size: Math.min(maxBuckets, jobAggregationSize)
|
||||
},
|
||||
aggs: {
|
||||
levels: {
|
||||
|
|
|
@ -89,7 +89,7 @@ export function jobsProvider(callWithRequest) {
|
|||
|
||||
async function jobsSummary(jobIds = []) {
|
||||
const fullJobsList = await createFullJobsList();
|
||||
const auditMessages = await getAuditMessagesSummary();
|
||||
const auditMessages = await getAuditMessagesSummary(fullJobsList.length);
|
||||
const auditMessagesByJob = auditMessages.reduce((p, c) => {
|
||||
p[c.job_id] = c;
|
||||
return p;
|
||||
|
|
Loading…
Reference in a new issue