def _condition_to_tag_check(self, sample, base_sc_name, mapping, scraper_config, tags=None):
        """
        Metrics from kube-state-metrics have changed
        For example:
        kube_node_status_condition{condition="Ready",node="ip-172-33-39-189.eu-west-1.compute",status="true"} 1
        kube_node_status_condition{condition="OutOfDisk",node="ip-172-33-57-130.eu-west-1.compute",status="false"} 1
        metric {
          label { name: "condition", value: "true"
          }
          # other labels here
          gauge { value: 1.0 }
        }

        This function evaluates metrics containing conditions and sends a service check
        based on a provided condition->check mapping dict
        """
        if bool(sample[self.SAMPLE_VALUE]) is False:
            return  # Ignore if gauge is not 1 and we are not processing the pod phase check

        label_value, condition_map = self._get_metric_condition_map(base_sc_name, sample[self.SAMPLE_LABELS])
        service_check_name = condition_map['service_check_name']
        mapping = condition_map['mapping']

        node = self._label_to_tag('node', sample[self.SAMPLE_LABELS], scraper_config)
        condition = self._label_to_tag('condition', sample[self.SAMPLE_LABELS], scraper_config)
        message = "{} is currently reporting {} = {}".format(node, condition, label_value)

        if condition_map['service_check_name'] is None:
            self.log.debug("Unable to handle {} - unknown condition {}".format(service_check_name, label_value))
        else:
            self.service_check(service_check_name, mapping[label_value], tags=tags, message=message)
def _condition_to_tag_check ( self , sample , base_sc_name , mapping , scraper_config , tags = None ) : if bool ( sample [ self . SAMPLE_VALUE ] ) is False : return label_value , condition_map = self . _get_metric_condition_map ( base_sc_name , sample [ self . SAMPLE_LABELS ] ) service_check_name = condition_map [ 'service_check_name' ] mapping = condition_map [ 'mapping' ] node = self . _label_to_tag ( 'node' , sample [ self . SAMPLE_LABELS ] , scraper_config ) condition = self . _label_to_tag ( 'condition' , sample [ self . SAMPLE_LABELS ] , scraper_config ) message = "{} is currently reporting {} = {}" . format ( node , condition , label_value ) if condition_map [ 'service_check_name' ] is None : self . log . debug ( "Unable to handle {} - unknown condition {}" . format ( service_check_name , label_value ) ) else : self . service_check ( service_check_name , mapping [ label_value ] , tags = tags , message = message )
Metrics from kube-state-metrics have changed
        For example:
        kube_node_status_condition{condition="Ready",node="ip-172-33-39-189.eu-west-1.compute",status="true"} 1
        kube_node_status_condition{condition="OutOfDisk",node="ip-172-33-57-130.eu-west-1.compute",status="false"} 1
        metric {
          label { name: "condition", value: "true"
          }
          # other labels here
          gauge { value: 1.0 }
        }

        This function evaluates metrics containing conditions and sends a service check
        based on a provided condition->check mapping dict