Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make jmx endpoint work for local access #5831

Merged
merged 3 commits into from
Mar 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions activemq/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
HERE = get_here()
HOST = get_docker_hostname()

JMX_PORT = 1616

TEST_QUEUES = ('FOO_QUEUE', 'TEST_QUEUE')
TEST_TOPICS = ('FOO_TOPIC', 'TEST_TOPIC')
TEST_MESSAGE = {'body': 'test_message'}
Expand Down
10 changes: 7 additions & 3 deletions activemq/tests/compose/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ services:
image: rmohr/activemq:${ACTIVEMQ_VERSION}
container_name: dd-test-activemq-server
environment:
ACTIVEMQ_SUNJMX_START: "-Dcom.sun.management.jmxremote.port=1616 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
ACTIVEMQ_SUNJMX_START: >-
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, clever!

-Dcom.sun.management.jmxremote.port=${JMX_PORT}
-Dcom.sun.management.jmxremote.rmi.port=${JMX_PORT}
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Djava.rmi.server.hostname=localhost
ports:
- "61616:61616"
- "8161:8161"
- "1616:1616"
- "${JMX_PORT}:${JMX_PORT}"
4 changes: 3 additions & 1 deletion activemq/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from datadog_checks.dev.conditions import WaitForPortListening
from datadog_checks.dev.utils import load_jmx_config

from .common import BASE_URL, HERE, HOST, TEST_AUTH, TEST_MESSAGE, TEST_PORT, TEST_QUEUES, TEST_TOPICS
from .common import BASE_URL, HERE, HOST, JMX_PORT, TEST_AUTH, TEST_MESSAGE, TEST_PORT, TEST_QUEUES, TEST_TOPICS


def populate_server():
Expand All @@ -30,9 +30,11 @@ def populate_server():

@pytest.fixture(scope="session")
def dd_environment():
envs = {'JMX_PORT': str(JMX_PORT)}
with docker_run(
os.path.join(HERE, 'compose', 'docker-compose.yaml'),
log_patterns=['ActiveMQ Jolokia REST API available'],
conditions=[WaitForPortListening(HOST, TEST_PORT), populate_server],
env_vars=envs,
):
yield load_jmx_config(), {'use_jmx': True}