Commit a136151
committed
Add task and worker lifecycle metrics to Celery instrumentation
Introduce Flower-compatible metrics for Celery task and worker events:
- flower.events.total: counter for task-sent, task-received,
task-started, task-succeeded, task-failed, task-retried, task-revoked
- flower.task.runtime.seconds: histogram of task execution time
- flower.worker.number.of.currently.executing.tasks: gauge of in-flight
tasks per worker
- flower.worker.online: gauge tracking worker online/offline status
CeleryInstrumentor (child process) handles task tracing and task-level
metrics. CeleryWorkerInstrumentor (main process) handles worker
lifecycle signals (worker_ready, worker_shutdown) and main-process
events (task_received, task_revoked).
Prefetch-time metrics (task_prefetch_time_seconds, worker_prefetched_tasks)
are intentionally omitted — Celery splits task_received and task_prerun
across processes in prefork mode, making it impossible to compute the
delta without external event consumption.1 parent 87a01e6 commit a136151
9 files changed
Lines changed: 1659 additions & 89 deletions
File tree
- docs
- instrumentation/opentelemetry-instrumentation-celery
- src/opentelemetry/instrumentation/celery
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| 31 | + | |
| 32 | + | |
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
0 commit comments