Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
Merge "Fixes an issue where httpResponseCode metrics did not return"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed May 10, 2016
2 parents ebcc137 + 3776c3a commit 84b5128
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
9 changes: 5 additions & 4 deletions poppy/provider/akamai/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,8 @@ def get_metrics_by_domain(self, project_id, domain_name, regions,
region]))
else:
for region in regions:
metric_buckets.append('_'.join([metricType, domain_name,
metric_buckets.append('_'.join([metricType,
domain_name,
region]))

metrics_results = metrics_controller.read(metric_names=metric_buckets,
Expand All @@ -1263,10 +1264,10 @@ def get_metrics_by_domain(self, project_id, domain_name, regions,
for region in regions:
formatted_results[metricType][region] = []
for metric_name, metrics_response in metrics_results:
unquoted_metric_name = parse.unquote(
metric_name.split('_')[2]
metric_region = parse.unquote(
metric_name.split('_')[-1]
).lower()
if region.lower().replace(' ', '') == unquoted_metric_name:
if region.lower().replace(' ', '') == metric_region:
formatted_results[metricType][region].append(
metrics_response
)
Expand Down
19 changes: 10 additions & 9 deletions tests/unit/provider/akamai/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,12 +677,12 @@ def test_create_ssl_certificate_happy_path(
"parameters": [{
"name": "cnameHostname",
"value": "secure.san1.poppycdn.com"
}, {"name": "createType", "value": "modSan"},
}, {"name": "createType", "value": "modSan"},
{"name": "csr.cn",
"value": "secure.san3.poppycdn.com"},
{"name": "add.sans",
"value": "www.abc.com"}],
"lastStatusChange": "2015-03-19T21:47:10Z",
"lastStatusChange": "2015-03-19T21:47:10Z",
"spsId": 1789,
"status": sps_status,
"workflowProgress": workFlowProgress,
Expand Down Expand Up @@ -754,12 +754,12 @@ def test_create_ssl_certificate_negative_path(
"parameters": [{
"name": "cnameHostname",
"value": "secure.san1.poppycdn.com"
}, {"name": "createType", "value": "modSan"},
}, {"name": "createType", "value": "modSan"},
{"name": "csr.cn",
"value": "secure.san3.poppycdn.com"},
{"name": "add.sans",
"value": "www.abc.com"}],
"lastStatusChange": "2015-03-19T21:47:10Z",
"lastStatusChange": "2015-03-19T21:47:10Z",
"spsId": 1789,
"status": sps_status,
"workflowProgress": workFlowProgress,
Expand Down Expand Up @@ -908,12 +908,12 @@ def test_create_ssl_certificate_sps_api_post_failure(self):
"parameters": [{
"name": "cnameHostname",
"value": "secure.san1.poppycdn.com"
}, {"name": "createType", "value": "modSan"},
}, {"name": "createType", "value": "modSan"},
{"name": "csr.cn",
"value": "secure.san3.poppycdn.com"},
{"name": "add.sans",
"value": "www.abc.com"}],
"lastStatusChange": "2015-03-19T21:47:10Z",
"lastStatusChange": "2015-03-19T21:47:10Z",
"spsId": 1789,
"status": "SPS Request Complete",
"workflowProgress": "",
Expand Down Expand Up @@ -1020,9 +1020,10 @@ def test_get_metrics_by_domain_metrics_controller_return(self, metrictype):
if 'httpResponseCode' in metrictype:
http_series = metrictype.split('_')[1]
for region in regions:
metric_buckets.append('_'.join(['requestCount', domain_name,
region,
http_series]))
metric_buckets.append('_'.join(['httpResponseCode',
http_series,
domain_name,
region]))
else:
for region in regions:
metric_buckets.append('_'.join([metrictype, domain_name,
Expand Down

0 comments on commit 84b5128

Please sign in to comment.