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

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

Issue 1507093003: 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
144 def poll(self): 149 def poll(self):
145 LOGGER.info('Collecting results from %s', self._url) 150 LOGGER.info('Collecting results from %s', self._url)
146 151
147 if not os.path.isfile(self._url): 152 if not os.path.isfile(self._url):
148 LOGGER.info('No file found, assuming no data: %s', self._url) 153 LOGGER.info('No file found, assuming no data: %s', self._url)
149 return True 154 return True
150 155
151 try: 156 try:
152 rotated_name = rotated_filename(self._url) 157 rotated_name = rotated_filename(self._url)
153 # Remove the previous rotated file. We keep it on disk after 158 # Remove the previous rotated file. We keep it on disk after
(...skipping 12 matching lines...) Expand all
166 171
167 def handle_response(self, data): 172 def handle_response(self, data):
168 fields = self.fields({k: data.get(k, 'unknown') for k in self.field_keys}) 173 fields = self.fields({k: data.get(k, 'unknown') for k in self.field_keys})
169 self.result_count.increment(fields) 174 self.result_count.increment(fields)
170 if 'duration_s' in data: 175 if 'duration_s' in data:
171 self.cycle_times.add(data['duration_s'], fields) 176 self.cycle_times.add(data['duration_s'], fields)
172 if 'pending_s' in data: 177 if 'pending_s' in data:
173 self.pending_times.add(data['pending_s'], fields) 178 self.pending_times.add(data['pending_s'], fields)
174 if 'total_s' in data: 179 if 'total_s' in data:
175 self.total_times.add(data['total_s'], fields) 180 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