Skip to main content
Baton connectors running in service mode can expose HTTP health check endpoints for container orchestrators (ECS Fargate, Kubernetes, etc.) to monitor connector health.

Enabling health checks

Health checks are disabled by default. Enable them using environment variables or CLI flags:
Environment variableCLI flagDefaultDescription
BATON_HEALTH_CHECK--health-checkfalseEnable the health check server
BATON_HEALTH_CHECK_PORT--health-check-port8081Port for the health check server
BATON_HEALTH_CHECK_BIND_ADDRESS--health-check-bind-address127.0.0.1Bind address for the health check server

Health check endpoints

EndpointDescriptionSuccess (HTTP 200)Failure (HTTP 503)
/healthFull health check - calls the connector’s Validate() methodConnector is healthyConnector validation failed
/readyReadiness check - verifies connector client is availableConnector is ready to serve requestsConnector client not available
/liveLiveness check - verifies process is runningAlways returns successN/A

The health-check command

Each connector includes a health-check subcommand for querying the health check server. This is designed for container exec probes, eliminating the need to bundle curl or other HTTP clients in container images.

Usage

# Check health (default endpoint)
baton-myconnector health-check

# Check readiness
baton-myconnector health-check --endpoint=ready

# Check liveness
baton-myconnector health-check --endpoint=live

# Check with custom port
baton-myconnector health-check --health-check-port=9090

Flags

FlagDefaultDescription
--endpointhealthEndpoint to check: health, ready, or live
--timeout5Request timeout in seconds
--health-check-port8081Port to connect to
--health-check-bind-address127.0.0.1Address to connect to

Exit codes

ScenarioExit code
HTTP 200 response0 (success)
HTTP non-200 response1 (failure)
Connection failed1 (failure)
Timeout1 (failure)

Container orchestrator examples

AWS ECS Fargate

{
  "healthCheck": {
    "command": ["CMD", "/baton-myconnector", "health-check"],
    "interval": 30,
    "timeout": 10,
    "retries": 3,
    "startPeriod": 60
  }
}

Kubernetes

livenessProbe:
  exec:
    command: ["/baton-myconnector", "health-check", "--endpoint=live"]
  initialDelaySeconds: 10
  periodSeconds: 5

readinessProbe:
  exec:
    command: ["/baton-myconnector", "health-check", "--endpoint=ready"]
  initialDelaySeconds: 5
  periodSeconds: 3