(self, instance)
return config
Validates the instance configuration and creates a scraper configuration for a new instance.
        If the endpoint already has a corresponding configuration, return the cached configuration.
Validates the instance configuration and creates a scraper configuration for a new instance.
        If the endpoint already has a corresponding configuration, return the cached configuration.
Validates the instance configuration and creates a scraper configuration for a new instance . If the endpoint already has a corresponding configuration return the cached configuration .
def get_scraper_config(self, instance):
        """
        Validates the instance configuration and creates a scraper configuration for a new instance.
        If the endpoint already has a corresponding configuration, return the cached configuration.
        """
        endpoint = instance.get('prometheus_url')

        if endpoint is None:
            raise CheckException("Unable to find prometheus URL in config file.")

        # If we've already created the corresponding scraper configuration, return it
        if endpoint in self.config_map:
            return self.config_map[endpoint]

        # Otherwise, we create the scraper configuration
        config = self.create_scraper_configuration(instance)

        # Add this configuration to the config_map
        self.config_map[endpoint] = config

        return config
def get_scraper_config ( self , instance ) : endpoint = instance . get ( 'prometheus_url' ) if endpoint is None : raise CheckException ( "Unable to find prometheus URL in config file." ) # If we've already created the corresponding scraper configuration, return it if endpoint in self . config_map : return self . config_map [ endpoint ] # Otherwise, we create the scraper configuration config = self . create_scraper_configuration ( instance ) # Add this configuration to the config_map self . config_map [ endpoint ] = config return config