mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
Task health calculation never returns Error or Warning but logs the HealthStatus (#139274)
* Task health calculation never returns Error or Warning but logs the HealthStatus.
This commit is contained in:
parent
8991e046a2
commit
7b4b2be2a6
2 changed files with 29 additions and 9 deletions
|
@ -362,18 +362,40 @@ describe('Task Run Statistics', () => {
|
|||
// Success, Success, Success, Failed
|
||||
{ Success: 75, RetryScheduled: 0, Failed: 25, status: 'OK' },
|
||||
// Success, Success, Success, Failed, Failed
|
||||
{ Success: 60, RetryScheduled: 0, Failed: 40, status: 'warn' },
|
||||
{ Success: 60, RetryScheduled: 0, Failed: 40, status: 'OK' },
|
||||
// Success, Success, Failed, Failed, Failed
|
||||
{ Success: 40, RetryScheduled: 0, Failed: 60, status: 'error' },
|
||||
{ Success: 40, RetryScheduled: 0, Failed: 60, status: 'OK' },
|
||||
// Success, Failed, Failed, Failed, RetryScheduled
|
||||
{ Success: 20, RetryScheduled: 20, Failed: 60, status: 'error' },
|
||||
{ Success: 20, RetryScheduled: 20, Failed: 60, status: 'OK' },
|
||||
// Failed, Failed, Failed, RetryScheduled, RetryScheduled
|
||||
{ Success: 0, RetryScheduled: 40, Failed: 60, status: 'error' },
|
||||
{ Success: 0, RetryScheduled: 40, Failed: 60, status: 'OK' },
|
||||
// Failed, Failed, RetryScheduled, RetryScheduled, Success
|
||||
{ Success: 20, RetryScheduled: 40, Failed: 40, status: 'warn' },
|
||||
{ Success: 20, RetryScheduled: 40, Failed: 40, status: 'OK' },
|
||||
// Failed, RetryScheduled, RetryScheduled, Success, Success
|
||||
{ Success: 40, RetryScheduled: 40, Failed: 20, status: 'OK' },
|
||||
]);
|
||||
|
||||
expect(logger.debug).toHaveBeenCalledTimes(5);
|
||||
expect(logger.debug).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
'Health Status warn threshold has been exceeded, resultFrequencySummary.Failed (40) is greater than warn_threshold (39)'
|
||||
);
|
||||
expect(logger.debug).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
'Health Status error threshold has been exceeded, resultFrequencySummary.Failed (60) is greater than error_threshold (59)'
|
||||
);
|
||||
expect(logger.debug).toHaveBeenNthCalledWith(
|
||||
3,
|
||||
'Health Status error threshold has been exceeded, resultFrequencySummary.Failed (60) is greater than error_threshold (59)'
|
||||
);
|
||||
expect(logger.debug).toHaveBeenNthCalledWith(
|
||||
4,
|
||||
'Health Status error threshold has been exceeded, resultFrequencySummary.Failed (60) is greater than error_threshold (59)'
|
||||
);
|
||||
expect(logger.debug).toHaveBeenNthCalledWith(
|
||||
5,
|
||||
'Health Status warn threshold has been exceeded, resultFrequencySummary.Failed (40) is greater than warn_threshold (39)'
|
||||
);
|
||||
resolve();
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
|
|
|
@ -434,14 +434,12 @@ function getHealthStatus(
|
|||
if (resultFrequencySummary.Failed > executionErrorThreshold.warn_threshold) {
|
||||
if (resultFrequencySummary.Failed > executionErrorThreshold.error_threshold) {
|
||||
logger.debug(
|
||||
`setting HealthStatus.Error because resultFrequencySummary.Failed (${resultFrequencySummary.Failed}) > error_threshold (${executionErrorThreshold.error_threshold})`
|
||||
`Health Status error threshold has been exceeded, resultFrequencySummary.Failed (${resultFrequencySummary.Failed}) is greater than error_threshold (${executionErrorThreshold.error_threshold})`
|
||||
);
|
||||
return HealthStatus.Error;
|
||||
} else {
|
||||
logger.debug(
|
||||
`setting HealthStatus.Warning because resultFrequencySummary.Failed (${resultFrequencySummary.Failed}) > warn_threshold (${executionErrorThreshold.warn_threshold})`
|
||||
`Health Status warn threshold has been exceeded, resultFrequencySummary.Failed (${resultFrequencySummary.Failed}) is greater than warn_threshold (${executionErrorThreshold.warn_threshold})`
|
||||
);
|
||||
return HealthStatus.Warning;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue