Skip to content

Commit

Permalink
Fix bug in capacity warning logs when assumedAverageRecurringRequired…
Browse files Browse the repository at this point in the history
…ThroughputPerMinutePerKibana was sufficient (elastic#200578)

In this PR, I'm fixing a bug where the task manager unhealthy logs were
showing the wrong reason. Because the if condition was checking
`assumedAverageRecurringRequiredThroughputPerMinutePerKibana` to be less
than `capacityPerMinutePerKibana`, it would log this as the reason task
manager is healthy. However whenever the value is less, it means task
manager is running fine from a recurring task perspective. Changing the
if condition allows the next step in the code to log which then logs
`assumedRequiredThroughputPerMinutePerKibana` as the real reason why
task manager is unhealthy.

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
mikecote and kibanamachine authored Nov 22, 2024
1 parent 1cb56d7 commit 9fa8ec7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ describe('estimateCapacity', () => {
value: expect.any(Object),
});
expect(logger.warn).toHaveBeenCalledWith(
'Task Manager is unhealthy, the assumedAverageRecurringRequiredThroughputPerMinutePerKibana (175) < capacityPerMinutePerKibana (200)'
'Task Manager is unhealthy, the assumedRequiredThroughputPerMinutePerKibana (215) >= capacityPerMinutePerKibana (200)'
);
});

Expand Down Expand Up @@ -710,7 +710,7 @@ describe('estimateCapacity', () => {
value: expect.any(Object),
});
expect(logger.warn).toHaveBeenCalledWith(
'Task Manager is unhealthy, the assumedRequiredThroughputPerMinutePerKibana (250) >= capacityPerMinutePerKibana (200) AND assumedAverageRecurringRequiredThroughputPerMinutePerKibana (210) >= capacityPerMinutePerKibana (200)'
'Task Manager is unhealthy, the assumedAverageRecurringRequiredThroughputPerMinutePerKibana (210) > capacityPerMinutePerKibana (200)'
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,13 @@ function getHealthStatus(
return { status: HealthStatus.OK, reason };
}

if (assumedAverageRecurringRequiredThroughputPerMinutePerKibana < capacityPerMinutePerKibana) {
const reason = `Task Manager is unhealthy, the assumedAverageRecurringRequiredThroughputPerMinutePerKibana (${assumedAverageRecurringRequiredThroughputPerMinutePerKibana}) < capacityPerMinutePerKibana (${capacityPerMinutePerKibana})`;
if (assumedAverageRecurringRequiredThroughputPerMinutePerKibana > capacityPerMinutePerKibana) {
const reason = `Task Manager is unhealthy, the assumedAverageRecurringRequiredThroughputPerMinutePerKibana (${assumedAverageRecurringRequiredThroughputPerMinutePerKibana}) > capacityPerMinutePerKibana (${capacityPerMinutePerKibana})`;
logger.warn(reason);
return { status: HealthStatus.OK, reason };
}

const reason = `Task Manager is unhealthy, the assumedRequiredThroughputPerMinutePerKibana (${assumedRequiredThroughputPerMinutePerKibana}) >= capacityPerMinutePerKibana (${capacityPerMinutePerKibana}) AND assumedAverageRecurringRequiredThroughputPerMinutePerKibana (${assumedAverageRecurringRequiredThroughputPerMinutePerKibana}) >= capacityPerMinutePerKibana (${capacityPerMinutePerKibana})`;
const reason = `Task Manager is unhealthy, the assumedRequiredThroughputPerMinutePerKibana (${assumedRequiredThroughputPerMinutePerKibana}) >= capacityPerMinutePerKibana (${capacityPerMinutePerKibana})`;
logger.warn(reason);
return { status: HealthStatus.OK, reason };
}
Expand Down

0 comments on commit 9fa8ec7

Please sign in to comment.