Skip to content

Commit

Permalink
chore: use prom to measure celery queue depth (#17682)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra authored Sep 29, 2023
1 parent 51aebe1 commit 44dde01
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions posthog/celery.py
Original file line number Diff line number Diff line change
@@ -57,6 +57,11 @@
labelnames=["task_name"],
)

CELERY_TASK_QUEUE_DEPTH_GAUGE = Gauge(
"posthog_celery_queue_depth",
"We use this to monitor the depth of the celery queue.",
)

# Using a string here means the worker doesn't have to serialize
# the configuration object to child processes.
# - namespace='CELERY' means all celery-related configuration keys
@@ -684,6 +689,9 @@ def redis_celery_queue_depth():

try:
llen = get_client().llen("celery")
CELERY_TASK_QUEUE_DEPTH_GAUGE.set(llen)

# TODO this can be removed once we're using the prom metric for alerting
with pushed_metrics_registry("celery_redis_queue_depth") as registry:
depth_gauge = Gauge(
"posthog_celery_queue_depth",

0 comments on commit 44dde01

Please sign in to comment.