Don't enable the metric queue if there's no Cloudwatch

This commit is contained in:
Matt Jibson 2015-08-12 15:14:09 -04:00
parent b483209862
commit f043bc1379
3 changed files with 15 additions and 4 deletions

8
app.py
View file

@ -26,7 +26,7 @@ from util.saas.exceptionlog import Sentry
from util.names import urn_generator
from util.config.oauth import GoogleOAuthConfig, GithubOAuthConfig, GitLabOAuthConfig
from util.security.signing import Signer
from util.saas.cloudwatch import send_cloudwatch
from util.saas.cloudwatch import start_cloudwatch_sender
from util.saas.metricqueue import MetricQueue
from util.config.provider import FileConfigProvider, TestConfigProvider
from util.config.configutil import generate_secret_key
@ -125,7 +125,11 @@ userevents = UserEventsBuilderModule(app)
superusers = SuperUserManager(app)
signer = Signer(app, OVERRIDE_CONFIG_DIRECTORY)
metric_queue = MetricQueue()
send_cloudwatch(metric_queue, app)
try:
start_cloudwatch_sender(metric_queue, app)
except KeyError:
logger.debug('Cloudwatch not configured')
tf = app.config['DB_TRANSACTION_FACTORY']