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
				
			
		|  | @ -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