Skip to main content

Prometheus Metrics

Scrape http://localhost:8080/metrics. Metric names have no taskdaemon_ prefix. Counters describe the running daemon process and reset on restart; they are not persisted totals from SQLite.

Runtime Metrics

worker_active, worker_idle, container_restarts_total, and container_wait_seconds are also registered. The current worker path does not update them; use the runtime metrics above rather than treating their zero values as activity measurements. queue_size includes delayed Pending retries and excludes Processing claims. Zero Pending does not prove that every task has completed. Use task states or exact completion counts to verify a drain. /health and gRPC GetHealth read a fresh Pending count; /api/metrics and /metrics use the sampled gauge. When embedding a standalone TaskService, call refresh_queue_metrics().await or start a daemon sampler. daemon_health does not monitor handler readiness or Docker connectivity. Use /health for a fresh storage check and completed smoke tasks to verify handler execution.

Prometheus Configuration

For Docker Compose, add Prometheus to the persistent daemon deployment:
The taskdaemon:8080 target works when both services share a Compose network. A Prometheus process on the host needs the published host address instead.

Useful Queries

Completed tasks and received tasks per second:
Average processing duration and 95th percentile by task type:
Terminal failure fraction, including timeouts and excluding retry scheduling:
Pending queue depth, pool occupancy, and retry rate:
Ratios need traffic in the window; an idle denominator can produce no finite value. Choose windows and alerts that match your expected workload.

Example Alerts

Queue thresholds are examples. Delayed retries contribute to Pending depth, and acquired batch tasks do not. Add application-specific failure and completion alerts for useful service-level monitoring.