Merge pull request #12725 from hashicorp/clarify-service-deregister-after-critical-message

improve error msg for deregister critical service
This commit is contained in:
Jared Kirschner 2022-04-07 18:01:54 -04:00 committed by GitHub
commit 9a81a77264
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

3
.changelog/12725.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
agent: improve log messages when a service with a critical health check is deregistered due to exceeding the deregister_critical_service_after timeout
```

View File

@ -1813,14 +1813,17 @@ func (a *Agent) reapServicesInternal() {
if timeout > 0 && cs.CriticalFor() > timeout {
reaped[serviceID] = true
if err := a.RemoveService(serviceID); err != nil {
a.logger.Error("unable to deregister service after check has been critical for too long",
a.logger.Error("failed to deregister service with critical health that exceeded health check's 'deregister_critical_service_after' timeout",
"service", serviceID.String(),
"check", checkID.String(),
"error", err)
"timeout", timeout.String(),
"error", err,
)
} else {
a.logger.Info("Check for service has been critical for too long; deregistered service",
a.logger.Info("deregistered service with critical health due to exceeding health check's 'deregister_critical_service_after' timeout",
"service", serviceID.String(),
"check", checkID.String(),
"timeout", timeout.String(),
)
}
}