Example #1
0
def test_check(aggregator, mock_coredns):
    c = CoreDNSCheck(CHECK_NAME, None, {}, instance)
    c.check(instance)

    aggregator.assert_metric(NAMESPACE + '.response_code_count')
    aggregator.assert_metric(NAMESPACE + '.response_code_count.count')
    aggregator.assert_metric(NAMESPACE + '.proxy_request_count')
    aggregator.assert_metric(NAMESPACE + '.proxy_request_count.count')
    aggregator.assert_metric(NAMESPACE + '.cache_hits_count')
    aggregator.assert_metric(NAMESPACE + '.cache_hits_count.count')
    aggregator.assert_metric(NAMESPACE + '.cache_misses_count')
    aggregator.assert_metric(NAMESPACE + '.cache_misses_count.count')
    aggregator.assert_metric(NAMESPACE + '.request_count')
    aggregator.assert_metric(NAMESPACE + '.request_count.count')
    aggregator.assert_metric(NAMESPACE + '.request_type_count')
    aggregator.assert_metric(NAMESPACE + '.request_type_count.count')
    aggregator.assert_metric(NAMESPACE + '.request_duration.seconds.sum')
    aggregator.assert_metric(NAMESPACE + '.request_duration.seconds.count')
    aggregator.assert_metric(NAMESPACE + '.proxy_request_duration.seconds.sum')
    aggregator.assert_metric(NAMESPACE +
                             '.proxy_request_duration.seconds.count')
    aggregator.assert_metric(NAMESPACE + '.request_size.bytes.sum')
    aggregator.assert_metric(NAMESPACE + '.request_size.bytes.count')
    aggregator.assert_metric(NAMESPACE + '.cache_size.count')

    assert aggregator.metrics_asserted_pct == 100.0
Example #2
0
    def test_docker(self, aggregator, dd_environment, dockerinstance):
        """
        Testing metrics emitted from docker container.
        """

        check = CoreDNSCheck('coredns', {}, {}, [dockerinstance])
        check.check(dockerinstance)

        # include_metrics that can be reproduced in a docker based test environment
        include_metrics = [
            NAMESPACE + '.request_count',
            NAMESPACE + '.cache_size.count',
            NAMESPACE + '.request_type_count',
            NAMESPACE + '.cache_misses_count',
            NAMESPACE + '.response_code_count',
            NAMESPACE + '.proxy_request_count',
            NAMESPACE + '.response_size.bytes.sum',
            NAMESPACE + '.response_size.bytes.count',
            NAMESPACE + '.request_size.bytes.sum',
            NAMESPACE + '.request_size.bytes.count',
            NAMESPACE + '.proxy_request_duration.seconds.sum',
            NAMESPACE + '.proxy_request_duration.seconds.count',
            NAMESPACE + '.request_duration.seconds.sum',
            NAMESPACE + '.request_duration.seconds.count',
        ]

        for metric in include_metrics:
            aggregator.assert_metric(metric)
Example #3
0
    def test_docker(self, aggregator, dd_environment, dockerinstance):
        """
        Testing metrics emitted from docker container.
        """

        check = CoreDNSCheck(CHECK_NAME, {}, [dockerinstance])
        check.check(dockerinstance)

        for metric in METRICS:
            aggregator.assert_metric(metric)
Example #4
0
    def test_docker(self, aggregator, dd_environment, dockerinstance):
        """
        Testing metrics emitted from docker container.
        """

        check = CoreDNSCheck(CHECK_NAME, {}, [dockerinstance])
        check.check(dockerinstance)

        for metric in METRICS:
            aggregator.assert_metric(metric)

        aggregator.assert_all_metrics_covered()
        aggregator.assert_metrics_using_metadata(get_metadata_metrics(),
                                                 check_submission_type=True)
Example #5
0
    def test_docker_omv2(self, aggregator, dd_environment, dd_run_check, docker_omv2_instance):
        """
        Testing OpenMetricsV2 metrics emitted from docker container.
        """

        check = CoreDNSCheck(CHECK_NAME, {}, [docker_omv2_instance])
        dd_run_check(check)

        for metric in METRICS_V2:
            aggregator.assert_metric(metric)

        aggregator.assert_all_metrics_covered()
        aggregator.assert_metrics_using_metadata(get_metadata_metrics(), check_submission_type=True)
Example #6
0
    def test_check(self, aggregator, mock_get, dd_run_check, instance):
        """
        Testing CoreDNS check.
        """

        check = CoreDNSCheck(CHECK_NAME, {}, [instance])
        dd_run_check(check)

        # check that we then get the count metrics also
        dd_run_check(check)

        # `.cache_hits_count` metric is only tested against the metrics fixtures file
        # because the metric is not available in docker/e2e.
        metrics = METRICS + [NAMESPACE + '.cache_hits_count']

        for metric in metrics:
            aggregator.assert_metric(metric)
Example #7
0
    def test_check_omv2(self, aggregator, mock_get, dd_run_check, omv2_instance):
        """
        Testing CoreDNS check OpenMetrics V2.
        """

        check = CoreDNSCheck(CHECK_NAME, {}, [omv2_instance])
        dd_run_check(check)

        # check that we then get the count metrics also
        dd_run_check(check)

        # `.cache_hits_count.count` metric is only tested against the metrics fixtures file
        # because the metric is not available in docker/e2e.
        metrics = METRICS_V2 + [NAMESPACE + '.cache_hits_count.count']

        for metric in metrics:
            aggregator.assert_metric(metric)
        aggregator.assert_metrics_using_metadata(get_metadata_metrics(), check_submission_type=True)
Example #8
0
    def test_check(self, aggregator, mock_get, instance):
        """
        Testing CoreDNS check.
        """

        check = CoreDNSCheck('coredns', {}, {}, [instance])
        check.check(instance)

        # check that we then get the count metrics also
        check.check(instance)

        for metric in self.METRICS:
            aggregator.assert_metric(metric)
Example #9
0
    def test_check(self, aggregator, mock_get, instance):
        """
        Testing CoreDNS check.
        """

        check = CoreDNSCheck(CHECK_NAME, {}, [instance])
        check.check(instance)

        # check that we then get the count metrics also
        check.check(instance)

        metrics = METRICS + [NAMESPACE + '.cache_hits_count']

        for metric in metrics:
            aggregator.assert_metric(metric)