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

Side by Side Diff: infra/services/mastermon/pollers.py

Issue 1515073003: Revert of mastermon: report step metrics (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 5 years 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 | « no previous file | infra/services/mastermon/test/pollers_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 # Copyright (c) 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 import collections 5 import collections
6 import copy 6 import copy
7 import json 7 import json
8 import logging 8 import logging
9 import os 9 import os
10 10
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 # better suited for build cycle times. 134 # better suited for build cycle times.
135 bucketer = ts_mon.GeometricBucketer( 135 bucketer = ts_mon.GeometricBucketer(
136 growth_factor=10**0.05, num_finite_buckets=100) 136 growth_factor=10**0.05, num_finite_buckets=100)
137 cycle_times = ts_mon.CumulativeDistributionMetric( 137 cycle_times = ts_mon.CumulativeDistributionMetric(
138 'buildbot/master/builders/builds/durations', bucketer=bucketer) 138 'buildbot/master/builders/builds/durations', bucketer=bucketer)
139 pending_times = ts_mon.CumulativeDistributionMetric( 139 pending_times = ts_mon.CumulativeDistributionMetric(
140 'buildbot/master/builders/builds/pending_durations', bucketer=bucketer) 140 'buildbot/master/builders/builds/pending_durations', bucketer=bucketer)
141 total_times = ts_mon.CumulativeDistributionMetric( 141 total_times = ts_mon.CumulativeDistributionMetric(
142 'buildbot/master/builders/builds/total_durations', bucketer=bucketer) 142 'buildbot/master/builders/builds/total_durations', bucketer=bucketer)
143 143
144 step_result_count = ts_mon.CounterMetric(
145 'buildbot/master/builders/steps/results/count')
146 step_times = ts_mon.CumulativeDistributionMetric(
147 'buildbot/master/builders/steps/durations', bucketer=bucketer)
148
149 def poll(self): 144 def poll(self):
150 LOGGER.info('Collecting results from %s', self._url) 145 LOGGER.info('Collecting results from %s', self._url)
151 146
152 if not os.path.isfile(self._url): 147 if not os.path.isfile(self._url):
153 LOGGER.info('No file found, assuming no data: %s', self._url) 148 LOGGER.info('No file found, assuming no data: %s', self._url)
154 return True 149 return True
155 150
156 try: 151 try:
157 rotated_name = rotated_filename(self._url) 152 rotated_name = rotated_filename(self._url)
158 # Remove the previous rotated file. We keep it on disk after 153 # Remove the previous rotated file. We keep it on disk after
(...skipping 12 matching lines...) Expand all
171 166
172 def handle_response(self, data): 167 def handle_response(self, data):
173 fields = self.fields({k: data.get(k, 'unknown') for k in self.field_keys}) 168 fields = self.fields({k: data.get(k, 'unknown') for k in self.field_keys})
174 self.result_count.increment(fields) 169 self.result_count.increment(fields)
175 if 'duration_s' in data: 170 if 'duration_s' in data:
176 self.cycle_times.add(data['duration_s'], fields) 171 self.cycle_times.add(data['duration_s'], fields)
177 if 'pending_s' in data: 172 if 'pending_s' in data:
178 self.pending_times.add(data['pending_s'], fields) 173 self.pending_times.add(data['pending_s'], fields)
179 if 'total_s' in data: 174 if 'total_s' in data:
180 self.total_times.add(data['total_s'], fields) 175 self.total_times.add(data['total_s'], fields)
181
182 if 'steps' in data:
183 for step in data['steps']:
184 step_fields = copy.copy(fields)
185 step_fields.update({
186 'step_name': step['step_name'],
187 'result': step['result'],
188 })
189
190 self.step_result_count.increment(step_fields)
191 self.step_times.add(step['duration_s'], step_fields)
OLDNEW
« no previous file with comments | « no previous file | infra/services/mastermon/test/pollers_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698