[chromeperf] fixes on perf_issue_services
- fix the path when calling alert_groups/all
- encode the test key when it has question mark
- return when jwt signing failed, and use get() instead of the key name to read the jwt.
Bug: chromium:1439636
Change-Id: I835194e91ed0b9556b5417b8fd09041e167bcdac
Reviewed-on: https://chromium-review.googlesource.com/c/catapult/+/4568655
Commit-Queue: Wenbin Zhang <wenbinzhang@google.com>
Reviewed-by: John Chen <johnchen@chromium.org>
diff --git a/dashboard/dashboard/services/perf_issue_service_client.py b/dashboard/dashboard/services/perf_issue_service_client.py
index 8f98802..408515b 100644
--- a/dashboard/dashboard/services/perf_issue_service_client.py
+++ b/dashboard/dashboard/services/perf_issue_service_client.py
@@ -6,6 +6,7 @@
from __future__ import absolute_import
import logging
+import urllib.parse
from dashboard.common import cloud_metric
from dashboard.common import utils
@@ -193,7 +194,8 @@
end_rev = anomaly.end_revision
url = _SERVICE_URL + _ALERT_GROUP_PREFIX
- url += 'test/%s/start/%s/end/%s' % (test_key, start_rev, end_rev)
+ url += 'test/%s/start/%s/end/%s' % (urllib.parse.quote_plus(test_key),
+ start_rev, end_rev)
try:
cloud_metric.PublishPerfIssueServiceRequests('GetAlertGroupsForAnomaly',
@@ -212,7 +214,7 @@
def GetAllActiveAlertGroups():
url = _SERVICE_URL + _ALERT_GROUP_PREFIX
- url += 'all/'
+ url += 'all'
try:
cloud_metric.PublishPerfIssueServiceRequests('GetAllActiveAlertGroups',
diff --git a/perf_issue_service/application/clients/sheriff_config_client.py b/perf_issue_service/application/clients/sheriff_config_client.py
index fcd37ec..2747b67 100644
--- a/perf_issue_service/application/clients/sheriff_config_client.py
+++ b/perf_issue_service/application/clients/sheriff_config_client.py
@@ -76,8 +76,9 @@
if response.get('status', None) != '200':
logging.error('Failed to generated signed jwt. Response: %s', response)
+ return
- jwt_token = json.loads(content.decode('utf-8'))['signedJwt']
+ jwt_token = json.loads(content.decode('utf-8')).get('signedJwt')
self.auth_header = {
'Authorization': 'Bearer {}'.format(jwt_token),
'Accept': 'application/json',