Commit 94a36e1
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 34bfc28 commit 94a36e1
9 files changed
Lines changed: 1670 additions & 80 deletions
File tree
- docs
- instrumentation/opentelemetry-instrumentation-celery
- src/opentelemetry/instrumentation/celery
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
18 | 25 | | |
19 | 26 | | |
20 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
50 | 52 | | |
51 | 53 | | |
52 | 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