diff --git a/x-pack/plugins/task_manager/server/lib/log_health_metrics.test.ts b/x-pack/plugins/task_manager/server/lib/log_health_metrics.test.ts index 28f9e02c4d4d9..4e17d64870a39 100644 --- a/x-pack/plugins/task_manager/server/lib/log_health_metrics.test.ts +++ b/x-pack/plugins/task_manager/server/lib/log_health_metrics.test.ts @@ -51,14 +51,14 @@ describe('logHealthMetrics', () => { logHealthMetrics(health, logger, config); const debugCalls = (logger as jest.Mocked).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', () => { diff --git a/x-pack/plugins/task_manager/server/lib/log_health_metrics.ts b/x-pack/plugins/task_manager/server/lib/log_health_metrics.ts index 1114b2861d3fa..8f9c676f5ea3f 100644 --- a/x-pack/plugins/task_manager/server/lib/log_health_metrics.ts +++ b/x-pack/plugins/task_manager/server/lib/log_health_metrics.ts @@ -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 ( @@ -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); } }