mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 09:27:43 +00:00
This also removes the convenient way to run statsd in the Dev VM, because we don't anticipate anyone doing that. It's just 2 lines of config to configure it anyway: STATSD_HOST = 'localhost' STATSD_PREFIX = 'user' (imported from commit 5b09422ee0e956bc7f336dd1e575634380b8bfa2)
26 lines
878 B
Python
26 lines
878 B
Python
from __future__ import absolute_import
|
|
|
|
from django.core.management.base import BaseCommand
|
|
from django.conf import settings
|
|
|
|
class Command(BaseCommand):
|
|
help = """Send some stats to statsd."""
|
|
|
|
def add_arguments(self, parser):
|
|
parser.add_argument('operation', metavar='<operation>', type=str,
|
|
choices=['incr', 'decr', 'timing', 'timer', 'gauge'],
|
|
help="incr|decr|timing|timer|gauge")
|
|
parser.add_argument('name', metavar='<name>', type=str)
|
|
parser.add_argument('val', metavar='<val>', type=str)
|
|
|
|
def handle(self, *args, **options):
|
|
operation = options['operation']
|
|
name = options['name']
|
|
val = options['val']
|
|
|
|
if settings.STATSD_HOST != '':
|
|
from statsd import statsd
|
|
|
|
func = getattr(statsd, operation)
|
|
func(name, val)
|