Change to only run the cloud watch reporter in the gunicorn_web
This commit is contained in:
parent
99bd16a69c
commit
b89ba61286
5 changed files with 17 additions and 9 deletions
|
@ -54,6 +54,7 @@ class SendToCloudWatch(Process):
|
|||
class QueueMetrics(object):
|
||||
def __init__(self, app=None):
|
||||
self.app = app
|
||||
self.sender = None
|
||||
if app is not None:
|
||||
self.state = self.init_app(app)
|
||||
else:
|
||||
|
@ -72,8 +73,7 @@ class QueueMetrics(object):
|
|||
request_queue = Queue()
|
||||
reporter = QueueingCloudWatchReporter(request_queue, namespace, req_capacity_name,
|
||||
build_percent_name)
|
||||
sender = SendToCloudWatch(request_queue, access_key, secret_key)
|
||||
sender.start()
|
||||
self.sender = SendToCloudWatch(request_queue, access_key, secret_key)
|
||||
else:
|
||||
reporter = NullReporter()
|
||||
|
||||
|
@ -82,5 +82,11 @@ class QueueMetrics(object):
|
|||
app.extensions['queuemetrics'] = reporter
|
||||
return reporter
|
||||
|
||||
def run(self):
|
||||
logger.debug('Asked to start CloudWatch reporter')
|
||||
if self.sender is not None:
|
||||
logger.debug('Starting CloudWatch reporter')
|
||||
self.sender.start()
|
||||
|
||||
def __getattr__(self, name):
|
||||
return getattr(self.state, name, None)
|
||||
|
|
Reference in a new issue