metrics: use config['name'] to get metric conf
This commit is contained in:
parent
f53dea46b7
commit
0d38e0b00b
2 changed files with 7 additions and 13 deletions
|
@ -29,9 +29,6 @@ class CloudWatchBuildReporter(BuildReporter):
|
|||
Implements a BuildReporter for Amazon's CloudWatch.
|
||||
"""
|
||||
def __init__(self, queue, namespace_name, completed_name, failed_name, incompleted_name):
|
||||
if None in (queue, namespace_name, completed_name, failed_name, incompleted_name):
|
||||
raise TypeError
|
||||
|
||||
self._queue = queue
|
||||
self._namespace_name = namespace_name
|
||||
self._completed_name = completed_name
|
||||
|
@ -61,10 +58,10 @@ class BuildMetrics(object):
|
|||
if app is not None:
|
||||
reporter_type = app.config.get('BUILD_METRICS_TYPE', 'Null')
|
||||
if reporter_type == 'CloudWatch':
|
||||
namespace = app.config.get('BUILD_METRICS_NAMESPACE')
|
||||
completed_name = app.config.get('BUILD_METRICS_COMPLETED_NAME')
|
||||
failed_name = app.config.get('BUILD_METRICS_FAILED_NAME')
|
||||
incompleted_name = app.config.get('BUILD_METRICS_INCOMPLETED_NAME')
|
||||
namespace = app.config['BUILD_METRICS_NAMESPACE']
|
||||
completed_name = app.config['BUILD_METRICS_COMPLETED_NAME']
|
||||
failed_name = app.config['BUILD_METRICS_FAILED_NAME']
|
||||
incompleted_name = app.config['BUILD_METRICS_INCOMPLETED_NAME']
|
||||
request_queue = get_queue(app)
|
||||
self._reporter = CloudWatchBuildReporter(request_queue, namespace, completed_name,
|
||||
failed_name, incompleted_name)
|
||||
|
|
|
@ -14,9 +14,6 @@ class NullReporter(object):
|
|||
class CloudWatchReporter(object):
|
||||
""" CloudWatchReporter reports work queue metrics to CloudWatch """
|
||||
def __init__(self, request_queue, namespace, need_capacity_name, build_percent_name):
|
||||
if None in (request_queue, namespace, need_capacity_name, build_percent_name):
|
||||
raise TypeError
|
||||
|
||||
self._namespace = namespace
|
||||
self._need_capacity_name = need_capacity_name
|
||||
self._build_percent_name = build_percent_name
|
||||
|
@ -47,9 +44,9 @@ class QueueMetrics(object):
|
|||
if app is not None:
|
||||
reporter_type = app.config.get('QUEUE_METRICS_TYPE', 'Null')
|
||||
if reporter_type == 'CloudWatch':
|
||||
namespace = app.config.get('QUEUE_METRICS_NAMESPACE')
|
||||
req_capacity_name = app.config.get('QUEUE_METRICS_CAPACITY_SHORTAGE_NAME')
|
||||
build_percent_name = app.config.get('QUEUE_METRICS_BUILD_PERCENT_NAME')
|
||||
namespace = app.config['QUEUE_METRICS_NAMESPACE']
|
||||
req_capacity_name = app.config['QUEUE_METRICS_CAPACITY_SHORTAGE_NAME']
|
||||
build_percent_name = app.config['QUEUE_METRICS_BUILD_PERCENT_NAME']
|
||||
|
||||
request_queue = get_queue(app)
|
||||
self._reporter = CloudWatchReporter(request_queue, namespace, req_capacity_name,
|
||||
|
|
Reference in a new issue