From f8cf18db813a2b3d8117ed277211740677b8b51f Mon Sep 17 00:00:00 2001 From: mettelephant Date: Sat, 8 May 2021 20:28:11 -0500 Subject: [PATCH 1/4] Reorder HealthCheck status logging --- .../HealthChecks/src/DefaultHealthCheckService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs b/src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs index 5ddf68dd1c9d..7222cbe22609 100644 --- a/src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs +++ b/src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs @@ -256,15 +256,15 @@ public static void HealthCheckEnd(ILogger logger, HealthCheckRegistration regist switch (entry.Status) { case HealthStatus.Healthy: - _healthCheckEndHealthy(logger, registration.Name, duration.TotalMilliseconds, entry.Status, entry.Description, null); + _healthCheckEndHealthy(logger, registration.Name, entry.Status, duration.TotalMilliseconds, entry.Description, null); break; case HealthStatus.Degraded: - _healthCheckEndDegraded(logger, registration.Name, duration.TotalMilliseconds, entry.Status, entry.Description, null); + _healthCheckEndDegraded(logger, registration.Name, entry.Status, duration.TotalMilliseconds, entry.Description, null); break; case HealthStatus.Unhealthy: - _healthCheckEndUnhealthy(logger, registration.Name, duration.TotalMilliseconds, entry.Status, entry.Description, entry.Exception); + _healthCheckEndUnhealthy(logger, registration.Name, entry.Status, duration.TotalMilliseconds, entry.Description, entry.Exception); break; } } From 4246be3a94a8ebf850af3135a119e30bcb0c2e65 Mon Sep 17 00:00:00 2001 From: mettelephant Date: Sat, 8 May 2021 20:47:37 -0500 Subject: [PATCH 2/4] Correct logger action --- .../HealthChecks/src/DefaultHealthCheckService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs b/src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs index 7222cbe22609..a20fdf358449 100644 --- a/src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs +++ b/src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs @@ -211,22 +211,22 @@ private static class Log // These are separate so they can have different log levels private static readonly string HealthCheckEndText = "Health check {HealthCheckName} with status {HealthStatus} completed after {ElapsedMilliseconds}ms with message '{HealthCheckDescription}'"; - private static readonly Action _healthCheckEndHealthy = LoggerMessage.Define( + private static readonly Action _healthCheckEndHealthy = LoggerMessage.Define( LogLevel.Debug, EventIds.HealthCheckEnd, HealthCheckEndText); - private static readonly Action _healthCheckEndDegraded = LoggerMessage.Define( + private static readonly Action _healthCheckEndDegraded = LoggerMessage.Define( LogLevel.Warning, EventIds.HealthCheckEnd, HealthCheckEndText); - private static readonly Action _healthCheckEndUnhealthy = LoggerMessage.Define( + private static readonly Action _healthCheckEndUnhealthy = LoggerMessage.Define( LogLevel.Error, EventIds.HealthCheckEnd, HealthCheckEndText); - private static readonly Action _healthCheckEndFailed = LoggerMessage.Define( + private static readonly Action _healthCheckEndFailed = LoggerMessage.Define( LogLevel.Error, EventIds.HealthCheckEnd, HealthCheckEndText); From 8a9137e18e77acd60a2879074ee5949b441fe3af Mon Sep 17 00:00:00 2001 From: Tim Kinealy Date: Sat, 8 May 2021 21:39:57 -0500 Subject: [PATCH 3/4] Correct function definition --- .../HealthChecks/src/DefaultHealthCheckService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs b/src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs index a20fdf358449..5c3e3e27b471 100644 --- a/src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs +++ b/src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs @@ -211,22 +211,22 @@ private static class Log // These are separate so they can have different log levels private static readonly string HealthCheckEndText = "Health check {HealthCheckName} with status {HealthStatus} completed after {ElapsedMilliseconds}ms with message '{HealthCheckDescription}'"; - private static readonly Action _healthCheckEndHealthy = LoggerMessage.Define( + private static readonly Action _healthCheckEndHealthy = LoggerMessage.Define( LogLevel.Debug, EventIds.HealthCheckEnd, HealthCheckEndText); - private static readonly Action _healthCheckEndDegraded = LoggerMessage.Define( + private static readonly Action _healthCheckEndDegraded = LoggerMessage.Define( LogLevel.Warning, EventIds.HealthCheckEnd, HealthCheckEndText); - private static readonly Action _healthCheckEndUnhealthy = LoggerMessage.Define( + private static readonly Action _healthCheckEndUnhealthy = LoggerMessage.Define( LogLevel.Error, EventIds.HealthCheckEnd, HealthCheckEndText); - private static readonly Action _healthCheckEndFailed = LoggerMessage.Define( + private static readonly Action _healthCheckEndFailed = LoggerMessage.Define( LogLevel.Error, EventIds.HealthCheckEnd, HealthCheckEndText); From e0a59f98596afcf01e926aad80f851ddf36fe8c5 Mon Sep 17 00:00:00 2001 From: mettelephant Date: Mon, 10 May 2021 11:58:43 -0500 Subject: [PATCH 4/4] Pull request suggestion Co-authored-by: Artak <34246760+mkArtakMSFT@users.noreply.github.com> --- src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs b/src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs index 5c3e3e27b471..878affb4bfc5 100644 --- a/src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs +++ b/src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs @@ -226,7 +226,7 @@ private static class Log EventIds.HealthCheckEnd, HealthCheckEndText); - private static readonly Action _healthCheckEndFailed = LoggerMessage.Define( + private static readonly Action _healthCheckEndFailed = LoggerMessage.Define( LogLevel.Error, EventIds.HealthCheckEnd, HealthCheckEndText);