(self, sample, sc_name, mapping, tags=None)
Some metrics contains conditions, labels that have "condition" as name and "true", "false", or "unknown"
        as value. The metric value is expected to be a gauge equal to 0 or 1 in this case.
        For example:

        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
Some metrics contains conditions, labels that have "condition" as name and "true", "false", or "unknown"
        as value. The metric value is expected to be a gauge equal to 0 or 1 in this case.
        For example:
Some metrics contains conditions labels that have condition as name and true false or unknown as value . The metric value is expected to be a gauge equal to 0 or 1 in this case . For example :
def _condition_to_service_check(self, sample, sc_name, mapping, tags=None):
        """
        Some metrics contains conditions, labels that have "condition" as name and "true", "false", or "unknown"
        as value. The metric value is expected to be a gauge equal to 0 or 1 in this case.
        For example:

        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
        condition = sample[self.SAMPLE_LABELS].get('condition')
        if condition:
            if condition in mapping:
                self.service_check(sc_name, mapping[condition], tags=tags)
            else:
                self.log.debug("Unable to handle %s - unknown condition %s", sc_name, condition)
def _condition_to_service_check ( self , sample , sc_name , mapping , tags = None ) : if bool ( sample [ self . SAMPLE_VALUE ] ) is False : return # Ignore if gauge is not 1 condition = sample [ self . SAMPLE_LABELS ] . get ( 'condition' ) if condition : if condition in mapping : self . service_check ( sc_name , mapping [ condition ] , tags = tags ) else : self . log . debug ( "Unable to handle %s - unknown condition %s" , sc_name , condition )