Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: infra/services/builder_alerts/crbug_issues.py

Issue 2174233002: Add more logging to builder_alerts to see why metrics are not reported (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fix Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « infra/services/builder_alerts/__main__.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from collections import defaultdict 5 from collections import defaultdict
6 import datetime 6 import datetime
7 import json 7 import json
8 import logging
8 9
9 from apiclient import discovery 10 from apiclient import discovery
10 from apiclient.errors import HttpError 11 from apiclient.errors import HttpError
11 import httplib2 12 import httplib2
12 from oauth2client import client 13 from oauth2client import client
13 14
14 from infra_libs import ts_mon 15 from infra_libs import ts_mon
15 16
16 17
17 # Dictionary mapping whitelisted lower-case labels to corresponding tree names. 18 # Dictionary mapping whitelisted lower-case labels to corresponding tree names.
(...skipping 27 matching lines...) Expand all
45 seen_issue_ids = set() 46 seen_issue_ids = set()
46 for whitelisted_label in WHITELISTED_LABELS: 47 for whitelisted_label in WHITELISTED_LABELS:
47 start_index = 0 48 start_index = 0
48 while True: 49 while True:
49 request = service.issues().list( 50 request = service.issues().list(
50 projectId='chromium', label=whitelisted_label, 51 projectId='chromium', label=whitelisted_label,
51 startIndex=start_index, maxResults=BATCH_SIZE, can='open') 52 startIndex=start_index, maxResults=BATCH_SIZE, can='open')
52 response = request.execute(num_retries=5) 53 response = request.execute(num_retries=5)
53 issue_tracker_requests.increment( 54 issue_tracker_requests.increment(
54 {'source': 'builder_alerts', 'operation': 'issues_list'}) 55 {'source': 'builder_alerts', 'operation': 'issues_list'})
56 logging.debug('Incremented issue_tracker_requests counter')
55 57
56 # Issue Tracker may omit certain issues occasionally, so counting whether 58 # Issue Tracker may omit certain issues occasionally, so counting whether
57 # they add up to 'totalResults' in response is not relaible. However, we 59 # they add up to 'totalResults' in response is not relaible. However, we
58 # can use the fact that 'items' is not present in response if we try to 60 # can use the fact that 'items' is not present in response if we try to
59 # list issues starting from an index beyond totalResults. 61 # list issues starting from an index beyond totalResults.
60 if not response.get('items'): 62 if not response.get('items'):
61 break 63 break
62 64
63 # Here we increment start_index by BATCH_SIZE rather then by the actual 65 # Here we increment start_index by BATCH_SIZE rather then by the actual
64 # number of returned issues in 'items' because as described above, issue 66 # number of returned issues in 'items' because as described above, issue
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 173
172 sheriff_issue['tags'] = sorted(tags) # converts back to list 174 sheriff_issue['tags'] = sorted(tags) # converts back to list
173 if severity is not None: 175 if severity is not None:
174 sheriff_issue['severity'] = severity 176 sheriff_issue['severity'] = severity
175 177
176 # We assume that a tags have 1:1 mapping to trees here. 178 # We assume that a tags have 1:1 mapping to trees here.
177 for tree_name in sheriff_issue['tags']: 179 for tree_name in sheriff_issue['tags']:
178 sheriff_issues[tree_name].append(sheriff_issue) 180 sheriff_issues[tree_name].append(sheriff_issue)
179 181
180 return sheriff_issues 182 return sheriff_issues
OLDNEW
« no previous file with comments | « infra/services/builder_alerts/__main__.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698