def test_check(aggregator, instance): check = MaprCheck('mapr', {}, [instance]) check.check(instance) for m in METRICS_IN_FIXTURE: aggregator.assert_metric(m) aggregator.assert_all_metrics_covered()
def test_whitelist(instance): instance['metric_whitelist'] = [r'mapr\.fs.*', r'mapr\.db.*'] check = MaprCheck('mapr', {}, [instance]) for m in ALLOWED_METRICS: if m.startswith('mapr.fs') or m.startswith('mapr.db'): assert check.should_collect_metric(m) else: assert not check.should_collect_metric(m)
def test_submit_gauge(instance, aggregator): check = MaprCheck('mapr', {}, [instance]) check.submit_metric(KAFKA_METRIC) aggregator.assert_metric( 'mapr.process.context_switch_involuntary', value=6308, tags=[ 'clustername:demo', 'process_name:apiserver', 'clusterid:7616098736519857348', 'fqdn:mapr-lab-2-ghs6.c.datadog-integrations-lab.internal', ], )
def test_submit_bucket(instance, aggregator): check = MaprCheck('mapr', {}, [instance]) check.submit_metric(DISTRIBUTION_METRIC) expected_tags = [ "mapr_cluster_id:7616098736519857348", "mapr_cluster:demo", "fqdn:mapr-lab-2-dhk4.c.datadog-integrations-lab.internal", "noindex://primary", "rpc_type:put", "table_fid:2070.42.262546", "table_path:/var/mapr/mapr.monitoring/tsdb-meta", ] aggregator.assert_histogram_bucket('mapr.db.table.latency', 21, 2, 5, False, 'stubbed.hostname', expected_tags) aggregator.assert_histogram_bucket('mapr.db.table.latency', 11, 5, 10, False, 'stubbed.hostname', expected_tags) aggregator.assert_all_metrics_covered() # No metrics submitted
def test_submit_gauge_additional_tags(instance, aggregator): instance['tags'] = ["foo:bar", "baz:biz"] check = MaprCheck('mapr', {}, [instance]) check.submit_metric(KAFKA_METRIC) aggregator.assert_metric( 'mapr.process.context_switch_involuntary', tags=[ 'clustername:demo', 'process_name:apiserver', 'clusterid:7616098736519857348', 'fqdn:mapr-lab-2-ghs6.c.datadog-integrations-lab.internal', 'foo:bar', 'baz:biz', ], )