Skip to content

Commit

Permalink
Merge branch 'master' into alex/hive_use_config_spec
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreYang authored Mar 6, 2020
2 parents 31fb004 + d57710e commit 91fdc85
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 12 deletions.
3 changes: 3 additions & 0 deletions hive/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@

HERE = get_here()
HOST = get_docker_hostname()

METASTORE_PORT = 8808
SERVER_PORT = 8809
20 changes: 14 additions & 6 deletions hive/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,27 @@
import pytest

from datadog_checks.dev import docker_run
from datadog_checks.dev.conditions import CheckDockerLogs
from datadog_checks.dev.utils import load_jmx_config

from .common import HERE
from .common import HERE, HOST, METASTORE_PORT, SERVER_PORT


@pytest.fixture(scope="session")
def dd_environment():
compose_file = os.path.join(HERE, 'compose', 'docker-compose.yaml')
with docker_run(
os.path.join(HERE, 'compose', 'docker-compose.yaml'),
log_patterns=[r'datanode:\(\d+\) is available', 'Starting Hive Metastore Server', 'Starting HiveServer2'],
sleep=2,
compose_file,
conditions=[
CheckDockerLogs(
compose_file,
[r'datanode:\d+ is available', 'Starting Hive Metastore Server', 'Starting HiveServer2'],
matches='all',
)
],
):
instance = {'host': 'localhost', 'port': 8809}
instance_metastore = {'host': HOST, 'port': METASTORE_PORT}
instance_server = {'host': HOST, 'port': SERVER_PORT}
config = load_jmx_config()
config['instances'] = [instance]
config['instances'] = [instance_metastore, instance_server]
yield config, {'use_jmx': True}
10 changes: 7 additions & 3 deletions hive/tests/test_check.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# (C) Datadog, Inc. 2019-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)

import pytest


@pytest.mark.e2e
def test(dd_agent_check):
instance = {}
aggregator = dd_agent_check(instance)
aggregator = dd_agent_check()
metrics = [
"hive.server.memory.heap.committed",
"hive.server.memory.heap.init",
Expand All @@ -24,6 +22,12 @@ def test(dd_agent_check):
"hive.server.memory.total.used",
"hive.server.session.active",
"hive.server.session.open",
"hive.metastore.api.get_all_tables.active_call",
"hive.metastore.api.get_all_functions.active_call",
"hive.metastore.open_connections",
"hive.metastore.partition.init",
"hive.metastore.api.get_all_databases.active_call",
"hive.metastore.api.init.active_call",
]
for metric in metrics:
aggregator.assert_metric(metric)
2 changes: 1 addition & 1 deletion kafka/datadog_checks/kafka/data/conf.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ init_config:
attribute:
Value:
metric_type: gauge
alias: kafka.net.handler.avg.idle.pct.rate
alias: kafka.net.processor.avg.idle.pct.rate
- include:
domain: 'kafka.server'
bean: 'kafka.server:type=KafkaRequestHandlerPool,name=RequestHandlerAvgIdlePercent'
Expand Down
2 changes: 1 addition & 1 deletion kafka/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"""

KAFKA_E2E_METRICS = [
"kafka.net.handler.avg.idle.pct.rate",
"kafka.net.processor.avg.idle.pct.rate",
# Request metrics:
"kafka.request.channel.queue.size",
"kafka.request.fetch_consumer.time.99percentile",
Expand Down
7 changes: 6 additions & 1 deletion kafka/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@
import pytest

from datadog_checks.dev import docker_run
from datadog_checks.dev.conditions import CheckDockerLogs
from datadog_checks.dev.utils import load_jmx_config

from .common import HERE


@pytest.fixture(scope='session')
def dd_environment():
with docker_run(os.path.join(HERE, 'compose', 'docker-compose.yml')):
compose_file = os.path.join(HERE, 'compose', 'docker-compose.yml')

with docker_run(
compose_file, conditions=[CheckDockerLogs(compose_file, [r'\[KafkaServer id=\d+\] started'], matches="all")]
):
yield load_jmx_config(), {'use_jmx': True}

0 comments on commit 91fdc85

Please sign in to comment.