Move zulip.com-related statsd configuration out of main settings.py.

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)
This commit is contained in:
Tim Abbott 2015-08-22 13:18:55 -07:00
parent 3e87c82d56
commit 930c64df8a
4 changed files with 10 additions and 21 deletions

View File

@ -40,7 +40,7 @@ class StatsDWrapper(object):
# Hand off to statsd if we have it enabled
# otherwise do nothing
if name in ['timer', 'timing', 'incr', 'decr', 'gauge']:
if settings.USING_STATSD:
if settings.STATSD_HOST != '':
from django_statsd.clients import statsd
if name == 'gauge':
return self._our_gauge

View File

@ -18,7 +18,7 @@ class Command(BaseCommand):
name = options['name']
val = options['val']
if settings.USING_STATSD:
if settings.STATSD_HOST != '':
from statsd import statsd
func = getattr(statsd, operation)

View File

@ -41,12 +41,15 @@ NOREPLY_EMAIL_ADDRESS = "noreply@zulip.com"
SESSION_SERIALIZER = "django.contrib.sessions.serializers.PickleSerializer"
STATSD_HOST = 'stats.zulip.net'
if ZULIP_COM_STAGING:
EXTERNAL_HOST = 'staging.zulip.com'
STATSD_PREFIX = 'staging'
else:
EXTERNAL_HOST = 'zulip.com'
EXTERNAL_API_PATH = 'api.zulip.com'
STATSD_PREFIX = 'app'
S3_BUCKET="humbug-user-uploads"
S3_AUTH_UPLOADS_BUCKET = "zulip-user-uploads"

View File

@ -154,6 +154,7 @@ DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '',
'EXTERNAL_URI_SCHEME': "https://",
'ZULIP_COM': False,
'ZULIP_COM_STAGING': False,
'STATSD_HOST': '',
'GOOGLE_CLIENT_ID': '',
'DBX_APNS_CERT_FILE': None,
}
@ -481,24 +482,9 @@ else:
# STATSD CONFIGURATION
########################################################################
LOCAL_STATSD = (False)
USING_STATSD = ZULIP_COM or LOCAL_STATSD
# These must be named STATSD_PREFIX for the statsd module
# to pick them up
if ZULIP_COM_STAGING:
STATSD_PREFIX = 'staging'
elif PRODUCTION:
STATSD_PREFIX = 'app'
else:
STATSD_PREFIX = 'user'
if USING_STATSD:
if LOCAL_STATSD:
STATSD_HOST = 'localhost'
else:
STATSD_HOST = 'stats.zulip.net'
# Statsd is not super well supported; if you want to use it you'll need
# to set STATSD_HOST and STATSD_PREFIX.
if STATSD_HOST != '':
INSTALLED_APPS += ['django_statsd']
STATSD_PORT = 8125
STATSD_CLIENT = 'django_statsd.clients.normal'