Skip to content

Commit

Permalink
update Detected potential performance message
Browse files Browse the repository at this point in the history
  • Loading branch information
pmuellr committed Aug 24, 2021
1 parent dcc5962 commit 7ebbfdd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ describe('logHealthMetrics', () => {
logHealthMetrics(health, logger, config);

const debugCalls = (logger as jest.Mocked<Logger>).debug.mock.calls;
const performanceMessage = `Detected potential performance issue with Task Manager. Set 'xpack.task_manager.monitored_stats_health_verbose_log.enabled: true' in your Kibana.yml to enable debug logging`;
const performanceMessage = /^Task Manager detected a degradation in performance/;
const lastStatsMessage = /^Latest Monitored Stats: \{.*\}$/;
expect(debugCalls[0][0] as string).toMatch(lastStatsMessage);
expect(debugCalls[1][0] as string).toMatch(lastStatsMessage);
expect(debugCalls[2][0] as string).toBe(performanceMessage);
expect(debugCalls[2][0] as string).toMatch(performanceMessage);
expect(debugCalls[3][0] as string).toMatch(lastStatsMessage);
expect(debugCalls[4][0] as string).toMatch(lastStatsMessage);
expect(debugCalls[5][0] as string).toBe(performanceMessage);
expect(debugCalls[5][0] as string).toMatch(performanceMessage);
});

it('should not log a warning message to enable verbose logging when the status goes from Warning to OK', () => {
Expand Down
5 changes: 2 additions & 3 deletions x-pack/plugins/task_manager/server/lib/log_health_metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export function logHealthMetrics(
}

const message = `Latest Monitored Stats: ${JSON.stringify(monitoredHealth)}`;
const detectedProblemMessage = `Task Manager detected a degradation in performance. This is usually temporary, and Kibana can recover automatically. If the problem persists, check the docs for troubleshooting information: https://www.elastic.co/guide/en/kibana/current/task-manager-health-monitoring.html .`;
if (enabled) {
const driftInSeconds = (monitoredHealth.stats.runtime?.value.drift.p99 ?? 0) / 1000;
if (
Expand Down Expand Up @@ -80,9 +81,7 @@ export function logHealthMetrics(
// This is legacy support - we used to always show this
logger.debug(message);
if (logLevel !== LogLevel.Debug && lastLogLevel === LogLevel.Debug) {
logger.debug(
`Detected potential performance issue with Task Manager. Set 'xpack.task_manager.monitored_stats_health_verbose_log.enabled: true' in your Kibana.yml to enable debug logging`
);
logger.debug(detectedProblemMessage);
}
}

Expand Down

0 comments on commit 7ebbfdd

Please sign in to comment.