(self, instance, init_config)
return gitlab_instance
Set up the gitlab instance so it can be used in OpenMetricsBaseCheck
Set up the gitlab instance so it can be used in OpenMetricsBaseCheck
Set up the gitlab instance so it can be used in OpenMetricsBaseCheck
def _create_gitlab_prometheus_instance(self, instance, init_config):
        """
        Set up the gitlab instance so it can be used in OpenMetricsBaseCheck
        """
        # Mapping from Gitlab specific Prometheus metric names to Datadog ones
        metrics = [METRICS_MAP]

        # Add allowed legacy metrics
        metrics.extend(init_config.get('allowed_metrics', []))

        gitlab_instance = deepcopy(instance)
        # gitlab uses 'prometheus_endpoint' and not 'prometheus_url', so we have to rename the key
        gitlab_instance['prometheus_url'] = instance.get('prometheus_url', instance.get('prometheus_endpoint'))

        self._tags = self._check_tags(gitlab_instance)

        gitlab_instance.update(
            {
                'namespace': 'gitlab',
                'metrics': metrics,
                # Defaults that were set when gitlab was based on PrometheusCheck
                'send_distribution_counts_as_monotonic': instance.get('send_distribution_counts_as_monotonic', False),
                'send_monotonic_counter': instance.get('send_monotonic_counter', False),
                'health_service_check': instance.get('health_service_check', False),
                'tags': self._tags,
            }
        )

        return gitlab_instance
def _create_gitlab_prometheus_instance ( self , instance , init_config ) : # Mapping from Gitlab specific Prometheus metric names to Datadog ones metrics = [ METRICS_MAP ] # Add allowed legacy metrics metrics . extend ( init_config . get ( 'allowed_metrics' , [ ] ) ) gitlab_instance = deepcopy ( instance ) # gitlab uses 'prometheus_endpoint' and not 'prometheus_url', so we have to rename the key gitlab_instance [ 'prometheus_url' ] = instance . get ( 'prometheus_url' , instance . get ( 'prometheus_endpoint' ) ) self . _tags = self . _check_tags ( gitlab_instance ) gitlab_instance . update ( { 'namespace' : 'gitlab' , 'metrics' : metrics , # Defaults that were set when gitlab was based on PrometheusCheck 'send_distribution_counts_as_monotonic' : instance . get ( 'send_distribution_counts_as_monotonic' , False ) , 'send_monotonic_counter' : instance . get ( 'send_monotonic_counter' , False ) , 'health_service_check' : instance . get ( 'health_service_check' , False ) , 'tags' : self . _tags , } ) return gitlab_instance