Skip to main content
Version: v3.9.0

Health check

The healthcheck runner executes exec-based container health checks for the edgelet engine only. Docker and Podman rely on native engine healthcheck support and do not use this runner.

Code: internal/healthcheck/

Purpose​

  • Poll running containers on an interval
  • Run healthcheck commands via engine exec (HealthcheckEngine interface)
  • Track consecutive failures against microservice Retries policy
  • Update Process Manager / status when health state changes

Dependencies​

Depends onReason
processmanager / engineContainer list and exec
fieldagentMicroserviceProvider: healthcheck JSON on microservice model
statusreporterPublish health transitions
confighealthcheckIntervalSeconds
Used byReason
supervisorStarted only when containerEngine=edgelet and engine implements HealthcheckEngine

Lifecycle​

Start​

NewRunner(engine, healthcheckEngine, fieldAgent).Start(ctx):

  • No-op if healthcheckEngine == nil (docker/podman)
  • Default interval: 30s if healthcheckIntervalSeconds ≤ 0

Started in Supervisor after Process Manager wiring:

if cfg.ContainerEngine == constants.EngineEdgelet {
s.healthcheckRunner = healthcheck.NewRunner(eng, hcEng, s.fieldAgent)
s.healthcheckRunner.Start(s.ctx)
}

Stop​

Cancel context; wait for runner goroutine.

Check flow​

  1. List running containers from engine
  2. Resolve microservice by UUID via Field Agent
  3. Parse healthcheck field from microservice model (JSON)
  4. ExecWithExitCode with timeout
  5. Increment/decrement consecutive failure counter
  6. After retry threshold, mark unhealthy in status reporter

Uses workloadmeta helpers for label/env context where needed.

Configuration​

KeyDefaultEffect
healthcheckIntervalSeconds30Poll interval

Per-microservice healthcheck spec comes from Controller or manifest (healthcheck block).

External APIs​

No HTTP surface. Health reflected in:

  • Process Manager microservice status
  • Controller status POST (via Field Agent aggregation)

Observability​

  • Log module: "HealthcheckRunner"
  • Debug logs on exec failures and state transitions

Failure modes​

SymptomTypical cause
Runner not starteddocker/podman engine selected
Checks skippedMissing healthcheck on microservice
Flapping unhealthyShort timeout vs slow startup

Code map​

FileRole
runner.goMain loop, exec checks, failure tracking
runner_test.goUnit tests

Related: Engines, Process manager, Field agent.

Group 3See anything wrong with the document? Help us improve it!