def _build_tags(self, label_name, label_value, scraper_config, hostname=None):
     """
     Build a list of formated tags from `label_name` parameter. It also depend of the
     check configuration ('keep_ksm_labels' parameter)
     """
     tags = []
     # first use the labels_mapper
     tag_name = scraper_config['labels_mapper'].get(label_name, label_name)
     # then try to use the kube_labels_mapper
     kube_tag_name = kube_labels_mapper.get(tag_name, tag_name)
     label_value = to_string(label_value).lower()
     tags.append('{}:{}'.format(to_string(kube_tag_name), label_value))
     if self.keep_ksm_labels and (kube_tag_name != tag_name):
         tags.append('{}:{}'.format(to_string(tag_name), label_value))
     return tags
 def _format_tag(self, name, value, scraper_config):
     """
     Lookups the labels_mapper table to see if replacing the tag name is
     necessary, then returns a "name:value" tag string
     """
     return '%s:%s' % (scraper_config['labels_mapper'].get(
         name, name), to_string(value).lower())