Skip to content

Commit

Permalink
chore: log health check failures in master logs (#9291)
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasBlaskey authored May 2, 2024
1 parent 7496445 commit f1aa92e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions master/internal/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ func (m *Master) healthCheck(ctx context.Context) model.HealthCheck {
hc.Database = model.Healthy
_, err := db.Bun().NewSelect().Table("cluster_id").Exists(ctx)
if err != nil {
log.WithError(err).Error("database marked as unhealthy")
hc.Database = model.Unhealthy
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ func (m *DispatcherResourceManager) HealthCheck() []model.ResourceManagerHealth
status := model.Healthy
_, err := m.apiClient.getVersion(context.TODO(), m.syslog.WithField("caller", "HealthCheck"))
if err != nil {
m.syslog.WithError(err).Error("dispatcher resource manager marked as unhealthy")
status = model.Unhealthy
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ func TestHealthCheck(t *testing.T) {
podInterfaces: map[string]typedV1.PodInterface{
"namespace": mockPodInterface,
},
syslog: logrus.WithField("namespace", "test"),
},
}

Expand Down
1 change: 1 addition & 0 deletions master/internal/rm/kubernetesrm/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ func (p *pods) HealthStatus() model.HealthStatus {
for _, podInterface := range p.podInterfaces {
_, err := podInterface.List(context.TODO(), metaV1.ListOptions{Limit: 1})
if err != nil {
p.syslog.WithError(err).Error("kubernetes resource manager marked as unhealthy")
return model.Unhealthy
}
return model.Healthy
Expand Down

0 comments on commit f1aa92e

Please sign in to comment.