(self)
Dynamically determines which NGINX endpoints are enabled and Datadog supports getting metrics from
        by querying the NGINX APIs that list availabled endpoints. If an error is encountered,
        then it falls back to query all of the known endpoints available in the given NGINX Plus version.
Dynamically determines which NGINX endpoints are enabled and Datadog supports getting metrics from
        by querying the NGINX APIs that list availabled endpoints. If an error is encountered,
        then it falls back to query all of the known endpoints available in the given NGINX Plus version.
Dynamically determines which NGINX endpoints are enabled and Datadog supports getting metrics from by querying the NGINX APIs that list availabled endpoints . If an error is encountered then it falls back to query all of the known endpoints available in the given NGINX Plus version .
def _get_enabled_endpoints(self):
        """
        Dynamically determines which NGINX endpoints are enabled and Datadog supports getting metrics from
        by querying the NGINX APIs that list availabled endpoints. If an error is encountered,
        then it falls back to query all of the known endpoints available in the given NGINX Plus version.
        """
        available_endpoints = set()

        base_url = urljoin(self.url + "/", self.plus_api_version)
        http_url = urljoin(self.url + "/", self.plus_api_version + "/http")
        stream_url = urljoin(self.url + "/", self.plus_api_version + "/stream")

        try:
            self.log.debug("Querying base API url: %s", base_url)
            r = self._perform_request(base_url)
            r.raise_for_status()
            available_endpoints = set(r.json())
            http_avail = "http" in available_endpoints
            stream_avail = "stream" in available_endpoints

            if http_avail:
                self.log.debug("Querying http API url: %s", http_url)
                r = self._perform_request(http_url)
                r.raise_for_status()
                endpoints = set(r.json())
                http_endpoints = {'http/{}'.format(endpoint) for endpoint in endpoints}
                available_endpoints = available_endpoints.union(http_endpoints)

            if self.use_plus_api_stream and stream_avail:
                self.log.debug("Querying stream API url: %s", stream_url)
                r = self._perform_request(stream_url)
                r.raise_for_status()
                endpoints = set(r.json())
                stream_endpoints = {'stream/{}'.format(endpoint) for endpoint in endpoints}
                available_endpoints = available_endpoints.union(stream_endpoints)

            self.log.debug("Available endpoints are %s", available_endpoints)

            supported_endpoints = self._supported_endpoints(available_endpoints)
            self.log.debug("Supported endpoints are %s", supported_endpoints)
            return chain(iteritems(supported_endpoints))
        except Exception as e:
            self.log.warning(
                "Could not determine available endpoints from the API, "
                "falling back to monitor all endpoints supported in nginx version %s, %s",
                self.plus_api_version,
                str(e),
            )
            return self._get_all_plus_api_endpoints()
def _get_enabled_endpoints ( self ) : available_endpoints = set ( ) base_url = urljoin ( self . url + "/" , self . plus_api_version ) http_url = urljoin ( self . url + "/" , self . plus_api_version + "/http" ) stream_url = urljoin ( self . url + "/" , self . plus_api_version + "/stream" ) try : self . log . debug ( "Querying base API url: %s" , base_url ) r = self . _perform_request ( base_url ) r . raise_for_status ( ) available_endpoints = set ( r . json ( ) ) http_avail = "http" in available_endpoints stream_avail = "stream" in available_endpoints if http_avail : self . log . debug ( "Querying http API url: %s" , http_url ) r = self . _perform_request ( http_url ) r . raise_for_status ( ) endpoints = set ( r . json ( ) ) http_endpoints = { 'http/{}' . format ( endpoint ) for endpoint in endpoints } available_endpoints = available_endpoints . union ( http_endpoints ) if self . use_plus_api_stream and stream_avail : self . log . debug ( "Querying stream API url: %s" , stream_url ) r = self . _perform_request ( stream_url ) r . raise_for_status ( ) endpoints = set ( r . json ( ) ) stream_endpoints = { 'stream/{}' . format ( endpoint ) for endpoint in endpoints } available_endpoints = available_endpoints . union ( stream_endpoints ) self . log . debug ( "Available endpoints are %s" , available_endpoints ) supported_endpoints = self . _supported_endpoints ( available_endpoints ) self . log . debug ( "Supported endpoints are %s" , supported_endpoints ) return chain ( iteritems ( supported_endpoints ) ) except Exception as e : self . log . warning ( "Could not determine available endpoints from the API, " "falling back to monitor all endpoints supported in nginx version %s, %s" , self . plus_api_version , str ( e ) , ) return self . _get_all_plus_api_endpoints ( )