API endpoints for worker monitoring
GET /api/v1/workers
{ "workers": [ { "id": "worker_abc123", "hostname": "web-1", "pid": 12345, "status": "active", "queues": ["default", "mailers"], "concurrency": 5, "busy_threads": 3, "started_at": "2024-01-15T08:00:00Z", "last_heartbeat": "2024-01-15T10:30:00Z", "processed_count": 4521, "failed_count": 12, "memory_mb": 256, "cpu_percent": 15.2 } ], "summary": { "total_workers": 5, "total_threads": 25, "busy_threads": 18, "idle_threads": 7 } }
GET /api/v1/workers/:id
{ "id": "worker_abc123", "hostname": "web-1", "pid": 12345, "status": "active", "queues": ["default", "mailers"], "concurrency": 5, "busy_threads": 3, "started_at": "2024-01-15T08:00:00Z", "last_heartbeat": "2024-01-15T10:30:00Z", "processed_count": 4521, "failed_count": 12, "memory_mb": 256, "cpu_percent": 15.2, "current_jobs": [ { "job_id": "job_xyz", "class_name": "ProcessOrderJob", "started_at": "2024-01-15T10:29:58Z", "run_time_seconds": 2 } ] }
GET /api/v1/workers/stats
period
hour
day
week
{ "period": "day", "stats": { "avg_workers": 4.8, "max_workers": 5, "min_workers": 4, "avg_utilization": 72.5, "total_processed": 45210, "total_failed": 120, "avg_memory_mb": 245, "max_memory_mb": 312 }, "timeline": [ { "timestamp": "2024-01-15T10:00:00Z", "workers": 5, "utilization": 75.2, "throughput": 92 } ] }
POST /api/v1/workers/:id/quiet
{ "id": "worker_abc123", "status": "quiet", "message": "Worker will finish current jobs and stop accepting new ones" }
POST /api/v1/workers/:id/stop
{ "id": "worker_abc123", "status": "stopping", "message": "Worker will stop after completing current jobs" }
POST /api/v1/workers/quiet-all
{ "workers_quieted": 5, "message": "All workers will stop accepting new jobs" }