(self, scraper_config, metric_transformers=None)
Polls the data from Prometheus and submits them as Datadog metrics.
        `endpoint` is the metrics endpoint to use to poll metrics from Prometheus

        Note that if the instance has a `tags` attribute, it will be pushed
        automatically as additional custom tags and added to the metrics
Polls the data from Prometheus and submits them as Datadog metrics.
        `endpoint` is the metrics endpoint to use to poll metrics from Prometheus
Polls the data from Prometheus and submits them as Datadog metrics . endpoint is the metrics endpoint to use to poll metrics from Prometheus
def process(self, scraper_config, metric_transformers=None):
        """
        Polls the data from Prometheus and submits them as Datadog metrics.
        `endpoint` is the metrics endpoint to use to poll metrics from Prometheus

        Note that if the instance has a `tags` attribute, it will be pushed
        automatically as additional custom tags and added to the metrics
        """

        transformers = scraper_config['_default_metric_transformers'].copy()
        if metric_transformers:
            transformers.update(metric_transformers)

        counter_buffer = []
        agent_start_time = None
        process_start_time = None
        if not scraper_config['_flush_first_value'] and scraper_config['use_process_start_time']:
            agent_start_time = datadog_agent.get_process_start_time()

        for metric in self.scrape_metrics(scraper_config):
            if agent_start_time is not None:
                if metric.name == 'process_start_time_seconds' and metric.samples:
                    min_metric_value = min(s[self.SAMPLE_VALUE] for s in metric.samples)
                    if process_start_time is None or min_metric_value < process_start_time:
                        process_start_time = min_metric_value
                if metric.type in self.METRICS_WITH_COUNTERS:
                    counter_buffer.append(metric)
                    continue

            self.process_metric(metric, scraper_config, metric_transformers=transformers)

        if agent_start_time and process_start_time and agent_start_time < process_start_time:
            # If agent was started before the process, we assume counters were started recently from zero,
            # and thus we can compute the rates.
            scraper_config['_flush_first_value'] = True

        for metric in counter_buffer:
            self.process_metric(metric, scraper_config, metric_transformers=transformers)

        scraper_config['_flush_first_value'] = True
def process ( self , scraper_config , metric_transformers = None ) : transformers = scraper_config [ '_default_metric_transformers' ] . copy ( ) if metric_transformers : transformers . update ( metric_transformers ) counter_buffer = [ ] agent_start_time = None process_start_time = None if not scraper_config [ '_flush_first_value' ] and scraper_config [ 'use_process_start_time' ] : agent_start_time = datadog_agent . get_process_start_time ( ) for metric in self . scrape_metrics ( scraper_config ) : if agent_start_time is not None : if metric . name == 'process_start_time_seconds' and metric . samples : min_metric_value = min ( s [ self . SAMPLE_VALUE ] for s in metric . samples ) if process_start_time is None or min_metric_value < process_start_time : process_start_time = min_metric_value if metric . type in self . METRICS_WITH_COUNTERS : counter_buffer . append ( metric ) continue self . process_metric ( metric , scraper_config , metric_transformers = transformers ) if agent_start_time and process_start_time and agent_start_time < process_start_time : # If agent was started before the process, we assume counters were started recently from zero, # and thus we can compute the rates. scraper_config [ '_flush_first_value' ] = True for metric in counter_buffer : self . process_metric ( metric , scraper_config , metric_transformers = transformers ) scraper_config [ '_flush_first_value' ] = True