(self, instance)
return kube_dns_instance
Set up kube_dns instance so it can be used in OpenMetricsBaseCheck
Set up kube_dns instance so it can be used in OpenMetricsBaseCheck
Set up kube_dns instance so it can be used in OpenMetricsBaseCheck
def _create_kube_dns_instance(self, instance):
        """
        Set up kube_dns instance so it can be used in OpenMetricsBaseCheck
        """
        kube_dns_instance = deepcopy(instance)

        # kube_dns uses 'prometheus_endpoint' and not 'prometheus_url', so we have to rename the key
        kube_dns_instance['prometheus_url'] = instance.get('prometheus_endpoint', None)

        kube_dns_instance.update(
            {
                'namespace': 'kubedns',
                # Note: the count metrics were moved to specific functions list below to be submitted
                # as both gauges and monotonic_counts
                'metrics': [
                    {
                        # metrics have been renamed to kubedns in kubernetes 1.6.0
                        'kubedns_kubedns_dns_response_size_bytes': 'response_size.bytes',
                        'kubedns_kubedns_dns_request_duration_seconds': 'request_duration.seconds',
                        # metrics names for kubernetes < 1.6.0
                        'skydns_skydns_dns_response_size_bytes': 'response_size.bytes',
                        'skydns_skydns_dns_request_duration_seconds': 'request_duration.seconds',
                    }
                ],
                # Defaults that were set when kube_dns was based on PrometheusCheck
                'send_monotonic_counter': instance.get('send_monotonic_counter', False),
                'health_service_check': instance.get('health_service_check', False),
            }
        )

        return kube_dns_instance
def _create_kube_dns_instance ( self , instance ) : kube_dns_instance = deepcopy ( instance ) # kube_dns uses 'prometheus_endpoint' and not 'prometheus_url', so we have to rename the key kube_dns_instance [ 'prometheus_url' ] = instance . get ( 'prometheus_endpoint' , None ) kube_dns_instance . update ( { 'namespace' : 'kubedns' , # Note: the count metrics were moved to specific functions list below to be submitted # as both gauges and monotonic_counts 'metrics' : [ { # metrics have been renamed to kubedns in kubernetes 1.6.0 'kubedns_kubedns_dns_response_size_bytes' : 'response_size.bytes' , 'kubedns_kubedns_dns_request_duration_seconds' : 'request_duration.seconds' , # metrics names for kubernetes < 1.6.0 'skydns_skydns_dns_response_size_bytes' : 'response_size.bytes' , 'skydns_skydns_dns_request_duration_seconds' : 'request_duration.seconds' , } ] , # Defaults that were set when kube_dns was based on PrometheusCheck 'send_monotonic_counter' : instance . get ( 'send_monotonic_counter' , False ) , 'health_service_check' : instance . get ( 'health_service_check' , False ) , } ) return kube_dns_instance