def _PointInfoDict(row, parent_test, anomaly_annotation_map): """Makes a dict of properties of one Row.""" point_info = { 'value': row.value, 'a_trace_rerun_options': _GetTracingRerunOptions(row), } tracing_uri = _GetTracingUri(row) if tracing_uri: point_info['a_tracing_uri'] = tracing_uri old_stdio_uri = _GetOldStdioUri(row, parent_test) if old_stdio_uri: point_info.update( _CreateLinkProperty('stdio_uri', 'Buildbot stdio', old_stdio_uri)) if row.error is not None: point_info['error'] = row.error if anomaly_annotation_map.get(row.revision): anomaly_entity = anomaly_annotation_map.get(row.revision) point_info['g_anomaly'] = alerts.GetAnomalyDict(anomaly_entity) for name, val in row.to_dict().iteritems(): if name.startswith('r_'): point_info[name] = val elif name == 'a_default_rev': point_info['a_default_rev'] = val elif name == 'timestamp': point_info['timestamp'] = val elif name.startswith('a_') and _IsMarkdownLink(val): point_info[name] = val return point_info
def _PointInfoDict(row, anomaly_annotation_map): """Makes a dict of properties of one Row.""" point_info = { 'value': row.value, } tracing_uri = _GetTracingUri(row) if tracing_uri: point_info['a_tracing_uri'] = tracing_uri if row.error is not None: point_info['error'] = row.error if anomaly_annotation_map.get(row.revision): anomaly_entity = anomaly_annotation_map.get(row.revision) point_info['g_anomaly'] = alerts.GetAnomalyDict(anomaly_entity) row_dict = row.to_dict() for name, val in row_dict.iteritems(): if _IsMarkdownLink(val) and 'Buildbot stdio' in val: logdog_link, status_page_link = _GetUpdatedBuildbotLinks(val) if logdog_link: val = logdog_link # TODO(simonhatch): Remove this sometime in 2019. # crbug.com/891424 if status_page_link and not 'a_build_uri' in row_dict: point_info['a_buildbot_status_page'] = status_page_link if name.startswith('r_'): point_info[name] = val elif name == 'a_default_rev': point_info['a_default_rev'] = val elif name == 'timestamp': point_info['timestamp'] = val elif name.startswith('a_') and _IsMarkdownLink(val): point_info[name] = val return point_info
def _PointInfoDict(row, anomaly_annotation_map): """Makes a dict of properties of one Row.""" point_info = { 'value': row.value, } tracing_uri = _GetTracingUri(row) if tracing_uri: point_info['a_tracing_uri'] = tracing_uri if row.error is not None: point_info['error'] = row.error if anomaly_annotation_map.get(row.revision): anomaly_entity = anomaly_annotation_map.get(row.revision) point_info['g_anomaly'] = alerts.GetAnomalyDict(anomaly_entity) row_dict = row.to_dict() for name, val in row_dict.items(): if name.startswith('r_'): point_info[name] = val elif name == 'a_default_rev': point_info['a_default_rev'] = val elif name == 'timestamp': point_info['timestamp'] = val elif name.startswith('a_') and _IsMarkdownLink(val): point_info[name] = val return point_info
def _FetchAlerts(self): anomalies, _, _ = yield anomaly.Anomaly.QueryAsync( test_keys=self._test_keys, max_start_revision=self._max_revision, min_end_revision=self._min_revision) for alert in anomalies: if alert.internal_only: self._private = True datum = self._Datum(alert.end_revision) # TODO(benjhayden) bisect_status datum['alert'] = alerts.GetAnomalyDict(alert)
def _PointInfoDict(row, anomaly_annotation_map): """Makes a dict of properties of one Row.""" point_info = { 'value': row.value, 'a_trace_rerun_options': _GetTracingRerunOptions(row), } tracing_uri = _GetTracingUri(row) if tracing_uri: point_info['a_tracing_uri'] = tracing_uri if row.error is not None: point_info['error'] = row.error if anomaly_annotation_map.get(row.revision): anomaly_entity = anomaly_annotation_map.get(row.revision) point_info['g_anomaly'] = alerts.GetAnomalyDict(anomaly_entity) row_dict = row.to_dict() for name, val in row_dict.iteritems(): # TODO(sullivan): Remove this hack when data containing these broken links # is sufficiently stale, after June 2016. if (_IsMarkdownLink(val) and val.find('(None') != -1 and 'a_stdio_uri_prefix' in row_dict): # Many data points have been added with a stdio prefix expanded out to # 'None' when 'a_stdio_uri_prefix' is set correctly. Fix them up. # Add in the master name as well; if the waterfall is 'CamelCase' it # should be 'camel.client.case'. master_camel_case = utils.TestPath(row.parent_test).split('/')[0] master_parts = re.findall('([A-Z][a-z0-9]+)', master_camel_case) if master_parts and len(master_parts) == 2: master_name = '%s.client.%s' % (master_parts[1].lower(), master_parts[0].lower()) val = val.replace( '(None', '(%s/%s/' % (row_dict['a_stdio_uri_prefix'], master_name)) if _IsMarkdownLink(val) and 'Buildbot stdio' in val: logdog_link, status_page_link = _GetUpdatedBuildbotLinks(val) if logdog_link: val = logdog_link if status_page_link: point_info['a_buildbot_status_page'] = status_page_link if name.startswith('r_'): point_info[name] = val elif name == 'a_default_rev': point_info['a_default_rev'] = val elif name == 'timestamp': point_info['timestamp'] = val elif name.startswith('a_') and _IsMarkdownLink(val): point_info[name] = val return point_info
def testV2(self): alert = anomaly.Anomaly( bug_id=10, end_revision=20, internal_only=True, is_improvement=True, median_after_anomaly=30, median_before_anomaly=40, recovered=True, subscription_names=['Sheriff2'], subscriptions=[ Subscription(name='Sheriff2', bug_components=['component'], notification_email='*****@*****.**') ], start_revision=5, test=utils.TestKey('m/b/s/m/c'), units='ms', ).put().get() actual = alerts.GetAnomalyDict(alert, v2=True) del actual['dashboard_link'] self.assertEqual( { 'bug_components': ['component'], 'bug_id': 10, 'project_id': 'chromium', 'bug_labels': ['Restrict-View-Google'], 'descriptor': { 'testSuite': 's', 'measurement': 'm', 'bot': 'm:b', 'testCase': 'c', 'statistic': None, }, 'end_revision': 20, 'improvement': True, 'key': alert.key.urlsafe(), 'median_after_anomaly': 30, 'median_before_anomaly': 40, 'recovered': True, 'start_revision': 5, 'units': 'ms', 'pinpoint_bisects': [], }, actual)