Skip to content

Commit

Permalink
Revert "Add monitoring of celery queue size to statsd (#1589)"
Browse files Browse the repository at this point in the history
This reverts commit bc4e7c8.
  • Loading branch information
fuziontech committed Sep 5, 2020
1 parent bc4e7c8 commit 1e34dde
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions posthog/celery.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import os
import time
from datetime import datetime
from typing import Optional

import redis
import statsd # type: ignore
from celery import Celery
from celery import Celery, group
from celery.schedules import crontab
from dateutil import parser
from django.conf import settings
from django.db import connection
from django_statsd import utils # type: ignore

# set the default Django settings module for the 'celery' program.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "posthog.settings")
Expand Down Expand Up @@ -38,7 +39,6 @@
def setup_periodic_tasks(sender, **kwargs):
# Heartbeat every 10sec to make sure the worker is alive
sender.add_periodic_task(10.0, redis_heartbeat.s(), name="10 sec heartbeat", priority=0)
sender.add_periodic_task(1.0, redis_task_queue_length.s(), name="1 sec redis metric", priority=0)
sender.add_periodic_task(
crontab(day_of_week="mon,fri"), update_event_partitions.s(), # check twice a week
)
Expand All @@ -59,13 +59,6 @@ def redis_heartbeat():
redis_instance.set("POSTHOG_HEARTBEAT", int(time.time()))


@app.task()
def redis_task_queue_length():
g = utils.get_client("production_celery", class_=statsd.Gauge)
llen = redis_instance.llen("celery")
g.increment("celery_queue_depth", llen)


@app.task
def update_event_partitions():
with connection.cursor() as cursor:
Expand Down

0 comments on commit 1e34dde

Please sign in to comment.