(self, payload, prefix, metric_mapping, tags)
Parse a payload with a given metric_mapping and submit metric for valid values.
        Some values contain measurements like `GiB` which should be removed and only submitted if consistent
Parse a payload with a given metric_mapping and submit metric for valid values.
        Some values contain measurements like `GiB` which should be removed and only submitted if consistent
Parse a payload with a given metric_mapping and submit metric for valid values . Some values contain measurements like GiB which should be removed and only submitted if consistent
def submit_metrics(self, payload, prefix, metric_mapping, tags):
        """
        Parse a payload with a given metric_mapping and submit metric for valid values.
        Some values contain measurements like `GiB` which should be removed and only submitted if consistent
        """
        for key, metric in iteritems(metric_mapping):
            if key in payload:
                value = payload[key]

                if key in PARSE_METRICS:
                    try:
                        value_parsed = value.split(" ")
                        value = float(value_parsed[0])
                    except ValueError as e:
                        self.log.debug("Unable to parse value for %s: %s", key, str(e))
                        continue
                self.gauge('{}.'.format(prefix) + metric, value, tags)
            else:
                self.log.debug("Field not found in %s data: %s", prefix, key)
def submit_metrics ( self , payload , prefix , metric_mapping , tags ) : for key , metric in iteritems ( metric_mapping ) : if key in payload : value = payload [ key ] if key in PARSE_METRICS : try : value_parsed = value . split ( " " ) value = float ( value_parsed [ 0 ] ) except ValueError as e : self . log . debug ( "Unable to parse value for %s: %s" , key , str ( e ) ) continue self . gauge ( '{}.' . format ( prefix ) + metric , value , tags ) else : self . log . debug ( "Field not found in %s data: %s" , prefix , key )