From af08bcdb3fb32b5c883d9da3a72ae2443c4f5501 Mon Sep 17 00:00:00 2001 From: Gaurav Pandey Date: Fri, 25 Jun 2021 12:41:42 +0530 Subject: [PATCH] management: Delete send_stats command. This command is part of a statsd infrastructure that we stopped supporting years ago. Its only purpose for some time has been to provide sample code for how the restart script might trigger a notification to a graphing system, which doesn't justify maintaining it. Fixes part of #18898. --- scripts/restart-server | 5 ---- zerver/management/commands/send_stats.py | 30 ------------------------ 2 files changed, 35 deletions(-) delete mode 100644 zerver/management/commands/send_stats.py diff --git a/scripts/restart-server b/scripts/restart-server index 359ff95651..c1b83a8247 100755 --- a/scripts/restart-server +++ b/scripts/restart-server @@ -46,11 +46,6 @@ if pwd.getpwuid(os.getuid()).pw_name != "zulip": logging.error("Must be run as user 'zulip'.") sys.exit(1) -# Send a statsd event on restarting the server -subprocess.check_call( - ["./manage.py", "send_stats", "incr", "events.server_restart", str(int(time.time()))] -) - if args.fill_cache: logging.info("Filling memcached caches") subprocess.check_call(["./manage.py", "fill_memcached_caches"]) diff --git a/zerver/management/commands/send_stats.py b/zerver/management/commands/send_stats.py deleted file mode 100644 index 79a9522517..0000000000 --- a/zerver/management/commands/send_stats.py +++ /dev/null @@ -1,30 +0,0 @@ -from argparse import ArgumentParser -from typing import Any - -from django.conf import settings -from django.core.management.base import BaseCommand - - -class Command(BaseCommand): - help = """Send some stats to statsd.""" - - def add_arguments(self, parser: ArgumentParser) -> None: - parser.add_argument( - "operation", - metavar="", - choices=["incr", "decr", "timing", "timer", "gauge"], - help="incr|decr|timing|timer|gauge", - ) - parser.add_argument("name", metavar="") - parser.add_argument("val", metavar="") - - def handle(self, *args: Any, **options: str) -> None: - operation = options["operation"] - name = options["name"] - val = options["val"] - - if settings.STATSD_HOST != "": - from statsd import statsd - - func = getattr(statsd, operation) - func(name, val)