tools/metrics/ukm/xml_validations.py
def checkLocalMetricIsAggregated(self):
    """Checks that index fields don't list invalid metrics."""
    errors = []

    for event_node in self.config.getElementsByTagName('event'):
      metric_nodes = event_node.getElementsByTagName('metric')
      valid_index_field_metrics = {node.getAttribute('name')
                                   for node in metric_nodes
                                   if _isMetricValidAsIndexField(node)}
      for metric_node in metric_nodes:
        local_metric_index_fields = _getLocalMetricIndexFields(metric_node)
        invalid_metrics = local_metric_index_fields - valid_index_field_metrics
        if invalid_metrics:
          event_name = event_node.getAttribute('name')
          metric_name = metric_node.getAttribute('name')
          invalid_metrics_string = ', '.join(sorted(invalid_metrics))
          errors.append(INVALID_LOCAL_METRIC_FIELD_ERROR %(
                          {'event': event_name, 'metric': metric_name,
                           'invalid_metrics': invalid_metrics_string}))

    is_success = not errors
    return (is_success, errors)
Checks that index fields don't list invalid metrics.
Checks that index fields don't list invalid metrics.
Checks that index fields don ' t list invalid metrics .
def checkLocalMetricIsAggregated(self):
    errors = []
    for event_node in self.config.getElementsByTagName('event'):
      metric_nodes = event_node.getElementsByTagName('metric')
      valid_index_field_metrics = {node.getAttribute('name')
                                   for node in metric_nodes
                                   if _isMetricValidAsIndexField(node)}
      for metric_node in metric_nodes:
        local_metric_index_fields = _getLocalMetricIndexFields(metric_node)
        invalid_metrics = local_metric_index_fields - valid_index_field_metrics
        if invalid_metrics:
          event_name = event_node.getAttribute('name')
          metric_name = metric_node.getAttribute('name')
          invalid_metrics_string = ', '.join(sorted(invalid_metrics))
          errors.append(INVALID_LOCAL_METRIC_FIELD_ERROR %(
                          {'event': event_name, 'metric': metric_name,
                           'invalid_metrics': invalid_metrics_string}))
    is_success = not errors
    return (is_success, errors)
def checkLocalMetricIsAggregated ( self ) : errors = [ ] for event_node in self . config . getElementsByTagName ( 'event' ) : metric_nodes = event_node . getElementsByTagName ( 'metric' ) valid_index_field_metrics = { node . getAttribute ( 'name' ) for node in metric_nodes if _isMetricValidAsIndexField ( node ) } for metric_node in metric_nodes : local_metric_index_fields = _getLocalMetricIndexFields ( metric_node ) invalid_metrics = local_metric_index_fields - valid_index_field_metrics if invalid_metrics : event_name = event_node . getAttribute ( 'name' ) metric_name = metric_node . getAttribute ( 'name' ) invalid_metrics_string = ', ' . join ( sorted ( invalid_metrics ) ) errors . append ( INVALID_LOCAL_METRIC_FIELD_ERROR % ( { 'event' : event_name , 'metric' : metric_name , 'invalid_metrics' : invalid_metrics_string } ) ) is_success = not errors return ( is_success , errors )
Checks that index fields don't list invalid metrics.
Checks that index fields don ' t list invalid metrics .
"""Checks that index fields don't list invalid metrics."""
self