diff --git a/internal/health/check/docker.go b/internal/health/check/docker.go index 49462827..5d1d4cff 100644 --- a/internal/health/check/docker.go +++ b/internal/health/check/docker.go @@ -35,7 +35,7 @@ func NewDockerHealthcheckState(client *docker.SharedClient, containerId string) } } -func Docker(ctx context.Context, state *DockerHealthcheckState, containerId string, timeout time.Duration) (types.HealthCheckResult, error) { +func Docker(ctx context.Context, state *DockerHealthcheckState, timeout time.Duration) (types.HealthCheckResult, error) { if state.numDockerFailures > dockerFailuresThreshold { return types.HealthCheckResult{}, ErrDockerHealthCheckFailedTooManyTimes } @@ -44,7 +44,7 @@ func Docker(ctx context.Context, state *DockerHealthcheckState, containerId stri defer cancel() // the actual inspect response is intercepted and returned as RequestInterceptedError - _, err := state.client.ContainerInspect(ctx, containerId, client.ContainerInspectOptions{}) + _, err := state.client.ContainerInspect(ctx, state.containerId, client.ContainerInspectOptions{}) var interceptedErr *httputils.RequestInterceptedError if !httputils.AsRequestInterceptedError(err, &interceptedErr) { diff --git a/internal/health/check/http.go b/internal/health/check/http.go index 44d69b84..fb946131 100644 --- a/internal/health/check/http.go +++ b/internal/health/check/http.go @@ -106,6 +106,11 @@ func processHealthResponse(lat time.Duration, err error, getStatusCode func() in Detail: err.Error(), }, nil } + return types.HealthCheckResult{ + Latency: lat, + Healthy: true, + Detail: tlsErr.Error(), + }, nil } statusCode := getStatusCode() diff --git a/internal/health/monitor/monitor.go b/internal/health/monitor/monitor.go index 64bd4f62..93875115 100644 --- a/internal/health/monitor/monitor.go +++ b/internal/health/monitor/monitor.go @@ -42,7 +42,7 @@ type ( var ErrNegativeInterval = gperr.New("negative interval") -func (mon *monitor) init(u *url.URL, cfg types.HealthCheckConfig, healthCheckFunc HealthCheckFunc) *monitor { +func (mon *monitor) init(u *url.URL, cfg types.HealthCheckConfig, healthCheckFunc HealthCheckFunc) { if state := config.WorkingState.Load(); state != nil { cfg.ApplyDefaults(state.Value().Defaults.HealthCheck) } else { @@ -60,7 +60,6 @@ func (mon *monitor) init(u *url.URL, cfg types.HealthCheckConfig, healthCheckFun } else { mon.url.Store(u) } - return nil } func (mon *monitor) Context() context.Context { diff --git a/internal/health/monitor/new.go b/internal/health/monitor/new.go index d7e99eb5..5c2913de 100644 --- a/internal/health/monitor/new.go +++ b/internal/health/monitor/new.go @@ -98,7 +98,7 @@ func NewDockerHealthMonitor(config types.HealthCheckConfig, client *docker.Share var mon monitor mon.init(displayURL, config, func(u *url.URL) (result Result, err error) { - result, err = healthcheck.Docker(mon.Context(), state, containerId, config.Timeout) + result, err = healthcheck.Docker(mon.Context(), state, config.Timeout) if err != nil { if isFirstFailure { isFirstFailure = false