Remove dogstatsd-python in favor of dogapi

Also added datadog application to commom django apps and set it to use
a local statsd server by default.
This commit is contained in:
Carlos Andrés Rocha
2013-09-09 16:15:24 -04:00
parent 0734d835a1
commit ee0004e2f8
15 changed files with 97 additions and 64 deletions

View File

@@ -1,12 +1,25 @@
from django.conf import settings
from dogapi import dog_http_api, dog_stats_api
from dogapi import dog_stats_api, dog_http_api
def run():
"""
Initialize connection to datadog during django startup.
Expects the datadog api key in the DATADOG_API settings key
Can be configured using a dictionary named DATADOG in the django
project settings.
"""
if hasattr(settings, 'DATADOG_API'):
dog_http_api.api_key = settings.DATADOG_API
dog_stats_api.start(api_key=settings.DATADOG_API, statsd=True)
# By default use the statsd agent
options = {'statsd': True}
if hasattr(settings, 'DATADOG'):
options.update(settings.DATADOG)
# Not all arguments are documented.
# Look at the source code for details.
dog_stats_api.start(**options)
dog_http_api.api_key = options.get('api_key')