(self, metric_suffix, metric, scraper_config)
submit a kube_apiserver_metrics metric both as a gauge (for compatibility) and as a monotonic_count
submit a kube_apiserver_metrics metric both as a gauge (for compatibility) and as a monotonic_count
submit a kube_apiserver_metrics metric both as a gauge ( for compatibility ) and as a monotonic_count
def submit_as_gauge_and_monotonic_count(self, metric_suffix, metric, scraper_config):
        """
        submit a kube_apiserver_metrics metric both as a gauge (for compatibility) and as a monotonic_count
        """
        metric_name = scraper_config['namespace'] + metric_suffix
        for sample in metric.samples:
            # Explicit shallow copy of the instance tags
            _tags = list(scraper_config['custom_tags'])

            for label_name, label_value in iteritems(sample[self.SAMPLE_LABELS]):
                _tags.append('{}:{}'.format(label_name, label_value))
            # submit raw metric
            self.gauge(metric_name, sample[self.SAMPLE_VALUE], _tags)
            # submit rate metric
            self.monotonic_count(metric_name + '.count', sample[self.SAMPLE_VALUE], _tags)
def submit_as_gauge_and_monotonic_count ( self , metric_suffix , metric , scraper_config ) : metric_name = scraper_config [ 'namespace' ] + metric_suffix for sample in metric . samples : # Explicit shallow copy of the instance tags _tags = list ( scraper_config [ 'custom_tags' ] ) for label_name , label_value in iteritems ( sample [ self . SAMPLE_LABELS ] ) : _tags . append ( '{}:{}' . format ( label_name , label_value ) ) # submit raw metric self . gauge ( metric_name , sample [ self . SAMPLE_VALUE ] , _tags ) # submit rate metric self . monotonic_count ( metric_name + '.count' , sample [ self . SAMPLE_VALUE ] , _tags )