(self, m_name, metric, cache, scraper_config, pct_m_name=None)
Reports limit metrics if m_name is not an empty string,
        and optionally checks in the given cache if there's a usage
        for each sample in the metric and reports the usage_pct
Reports limit metrics if m_name is not an empty string,
        and optionally checks in the given cache if there's a usage
        for each sample in the metric and reports the usage_pct
Reports limit metrics if m_name is not an empty string and optionally checks in the given cache if there s a usage for each sample in the metric and reports the usage_pct
def _process_limit_metric(self, m_name, metric, cache, scraper_config, pct_m_name=None):
        """
        Reports limit metrics if m_name is not an empty string,
        and optionally checks in the given cache if there's a usage
        for each sample in the metric and reports the usage_pct
        """
        samples = self._sum_values_by_context(metric, self._get_entity_id_if_container_metric)
        for c_id, sample in iteritems(samples):
            limit = sample[self.SAMPLE_VALUE]
            pod_uid = self._get_pod_uid(sample[self.SAMPLE_LABELS])
            if self.pod_list_utils.is_excluded(c_id, pod_uid):
                continue

            tags = tagger.tag(replace_container_rt_prefix(c_id), tagger.HIGH)
            if not tags:
                continue
            tags += scraper_config['custom_tags']

            if m_name:
                self.gauge(m_name, limit, tags)

            if pct_m_name and limit > 0:
                c_name = self._get_container_label(sample[self.SAMPLE_LABELS], 'name')
                if not c_name:
                    continue
                usage, tags = cache.get(c_name, (None, None))
                if usage:
                    self.gauge(pct_m_name, float(usage / float(limit)), tags)
                else:
                    self.log.debug(
                        "No corresponding usage found for metric %s and container %s, skipping usage_pct for now.",
                        pct_m_name,
                        c_name,
                    )
def _process_limit_metric ( self , m_name , metric , cache , scraper_config , pct_m_name = None ) : samples = self . _sum_values_by_context ( metric , self . _get_entity_id_if_container_metric ) for c_id , sample in iteritems ( samples ) : limit = sample [ self . SAMPLE_VALUE ] pod_uid = self . _get_pod_uid ( sample [ self . SAMPLE_LABELS ] ) if self . pod_list_utils . is_excluded ( c_id , pod_uid ) : continue tags = tagger . tag ( replace_container_rt_prefix ( c_id ) , tagger . HIGH ) if not tags : continue tags += scraper_config [ 'custom_tags' ] if m_name : self . gauge ( m_name , limit , tags ) if pct_m_name and limit > 0 : c_name = self . _get_container_label ( sample [ self . SAMPLE_LABELS ] , 'name' ) if not c_name : continue usage , tags = cache . get ( c_name , ( None , None ) ) if usage : self . gauge ( pct_m_name , float ( usage / float ( limit ) ) , tags ) else : self . log . debug ( "No corresponding usage found for metric %s and container %s, skipping usage_pct for now." , pct_m_name , c_name , )