Key Concepts
Worker
A process running
ampd worker that executes extraction jobs- Node ID - Unique identifier (format:
^[a-zA-Z][a-zA-Z0-9_\-\.]*$) - Heartbeat - Health signal sent every 1 second to metadata database
- Worker Info - Build metadata (version, commit SHA, build date)
- Advisory Lock - PostgreSQL lock preventing duplicate node IDs
created_at- First registration (never changes)registered_at- Last re-registration (updates on restart)heartbeat_at- Last heartbeat (updates every 1 second)
Core Operations
List Workers
View all registered workers
Inspect Worker
Get detailed worker information
Monitor Health
Track heartbeats and availability
Troubleshoot
Debug worker issues
List Workers
View all registered workers and their last heartbeat times:Inspect Worker
Get detailed information including build version and timestamps:Monitor Worker Health
Workers send heartbeats every 1 second. A worker is considered active if its heartbeat is recent (typically within 5-30 seconds).Check Worker Status
Identify Stalled Workers
Continuous Monitoring
Troubleshooting Workers
Check Worker Versions
Identify Version Mismatches
Verify Deployment Rollout
Detect Worker Restarts
Comparecreated_at and registered_at timestamps:
Calculate Worker Uptime
Common Troubleshooting Scenarios
Scenario 1: Worker Not Accepting Jobs
Scenario 2: Worker Disappeared
Scenario 3: Version Mismatch Issues
Scenario 4: Duplicate Node IDs
The system prevents duplicate node IDs using PostgreSQL advisory locks:- Each worker acquires exclusive lock on its node_id
- Second worker with same ID fails to acquire lock
- Registration fails with lock conflict error
Monitoring Automation
Health Check Script
Deployment Verification
Alert on Inactive Workers
Worker Inventory Export
API Reference
Worker management endpoints:| Endpoint | Method | Description |
|---|---|---|
/workers | GET | List all workers |
/workers/{id} | GET | Get worker details by node ID |
For complete API schemas, see the Admin API OpenAPI specification.
Architecture
Worker health monitoring flow:- Worker - Sends heartbeats every 1 second
- Metadata DB - Stores worker state and heartbeat timestamps
- Advisory Lock - PostgreSQL lock preventing duplicate node IDs
- Admin API - Exposes worker information via HTTP
- ampctl - CLI for querying worker status
Next Steps
Job Management
Monitor jobs executed by workers
Monitoring
Set up worker health monitoring