def test_nginx_ingress_controller(aggregator, mock_data):
    """
    Testing nginx ingress controller.
    """

    c = NginxIngressControllerCheck(CHECK_NAME, None, {}, [instance])
    c.check(instance)
    # nginx metrics
    aggregator.assert_metric(NAMESPACE + '.nginx.connections.current')
    aggregator.assert_metric(NAMESPACE + '.nginx.connections.total')
    aggregator.assert_metric(NAMESPACE + '.nginx.requests.total')
    # nginx process metrics
    aggregator.assert_metric(NAMESPACE + '.nginx.process.count')
    aggregator.assert_metric(NAMESPACE + '.nginx.bytes.read')
    aggregator.assert_metric(NAMESPACE + '.nginx.bytes.write')
    aggregator.assert_metric(NAMESPACE + '.nginx.cpu.time')
    aggregator.assert_metric(NAMESPACE + '.nginx.mem.resident')
    aggregator.assert_metric(NAMESPACE + '.nginx.mem.virtual')
    # controller metrics
    aggregator.assert_metric(NAMESPACE + '.controller.reload.success')
    aggregator.assert_metric(NAMESPACE + '.controller.upstream.latency.count')
    aggregator.assert_metric(NAMESPACE + '.controller.upstream.latency.sum')
    aggregator.assert_metric(NAMESPACE + '.controller.upstream.latency.quantile')
    aggregator.assert_metric(NAMESPACE + '.controller.requests')
    aggregator.assert_metric(NAMESPACE + '.controller.cpu.time')
    aggregator.assert_metric(NAMESPACE + '.controller.mem.resident')
    aggregator.assert_metric(NAMESPACE + '.controller.mem.virtual')

    aggregator.assert_all_metrics_covered()
Пример #2
0
def test_with_histograms(aggregator, mock_data):
    """
    Testing nginx ingress controller with `collect_histogram` enabled.
    """
    c = NginxIngressControllerCheck(CHECK_NAME, {}, [INSTANCE_HISTO])
    c.check(INSTANCE_HISTO)

    for metric in EXPECTED_METRICS:
        aggregator.assert_metric(NAMESPACE + metric)

    aggregator.assert_metric(NAMESPACE + '.controller.response.duration.count')
    aggregator.assert_metric(NAMESPACE + '.controller.response.duration.sum')
    aggregator.assert_metric(NAMESPACE + '.controller.request.duration.count')
    aggregator.assert_metric(NAMESPACE + '.controller.request.duration.sum')

    aggregator.assert_all_metrics_covered()
    aggregator.assert_metrics_using_metadata(get_metadata_metrics(),
                                             check_metric_type=False)
Пример #3
0
def test_nginx_ingress_controller(aggregator, mock_data):
    """
    Testing nginx ingress controller.
    """

    c = NginxIngressControllerCheck(CHECK_NAME, {}, [INSTANCE])
    c.check(INSTANCE)

    for metric in EXPECTED_METRICS:
        aggregator.assert_metric(NAMESPACE + metric)

    # By default, the integration does not collect histogram metrics due to high label cardinality
    aggregator.assert_metric(NAMESPACE + '.controller.response.duration.count',
                             count=0)
    aggregator.assert_metric(NAMESPACE + '.controller.response.duration.sum',
                             count=0)
    aggregator.assert_metric(NAMESPACE + '.controller.request.duration.count',
                             count=0)
    aggregator.assert_metric(NAMESPACE + '.controller.request.duration.sum',
                             count=0)

    aggregator.assert_all_metrics_covered()
Пример #4
0
def test_nginx_ingress_controller(aggregator, instance, mock_data):
    """
    Testing nginx ingress controller.
    """

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

    for metric in EXPECTED_METRICS:
        aggregator.assert_metric(NAMESPACE + metric)

    # By default, the integration does not collect histogram metrics due to high label cardinality
    aggregator.assert_metric(NAMESPACE + '.controller.response.duration.count',
                             count=0)
    aggregator.assert_metric(NAMESPACE + '.controller.response.duration.sum',
                             count=0)
    aggregator.assert_metric(NAMESPACE + '.controller.request.duration.count',
                             count=0)
    aggregator.assert_metric(NAMESPACE + '.controller.request.duration.sum',
                             count=0)

    aggregator.assert_all_metrics_covered()
    aggregator.assert_metrics_using_metadata(get_metadata_metrics(),
                                             check_submission_type=True)