(self, metrics, metric_name_and_type_by_property)
Resolve metric names and types and submit it.
Resolve metric names and types and submit it.
Resolve metric names and types and submit it .
def _submit_metrics(self, metrics, metric_name_and_type_by_property):
        # type: (List[WMIMetric], Dict[str, Tuple[str, str]]) -> None
        """
        Resolve metric names and types and submit it.
        """
        for metric in metrics:
            if (
                metric.name not in metric_name_and_type_by_property
                and metric.name.lower() not in metric_name_and_type_by_property
            ):
                # Only report the metrics that were specified in the configuration
                # Ignore added properties like 'Timestamp_Sys100NS', `Frequency_Sys100NS`, etc ...
                continue

            if metric_name_and_type_by_property.get(metric.name):
                metric_name, metric_type = metric_name_and_type_by_property[metric.name]
            elif metric_name_and_type_by_property.get(metric.name.lower()):
                metric_name, metric_type = metric_name_and_type_by_property[metric.name.lower()]
            else:
                continue

            try:
                func = getattr(self, metric_type.lower())
            except AttributeError:
                raise Exception(u"Invalid metric type: {0}".format(metric_type))

            func(metric_name, metric.value, metric.tags)
def _submit_metrics ( self , metrics , metric_name_and_type_by_property ) : # type: (List[WMIMetric], Dict[str, Tuple[str, str]]) -> None for metric in metrics : if ( metric . name not in metric_name_and_type_by_property and metric . name . lower ( ) not in metric_name_and_type_by_property ) : # Only report the metrics that were specified in the configuration # Ignore added properties like 'Timestamp_Sys100NS', `Frequency_Sys100NS`, etc ... continue if metric_name_and_type_by_property . get ( metric . name ) : metric_name , metric_type = metric_name_and_type_by_property [ metric . name ] elif metric_name_and_type_by_property . get ( metric . name . lower ( ) ) : metric_name , metric_type = metric_name_and_type_by_property [ metric . name . lower ( ) ] else : continue try : func = getattr ( self , metric_type . lower ( ) ) except AttributeError : raise Exception ( u"Invalid metric type: {0}" . format ( metric_type ) ) func ( metric_name , metric . value , metric . tags )