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

KAFKA-14582: Move JmxTool to tools #13136

Merged
merged 9 commits into from Feb 2, 2023
Merged

Conversation

fvaleri
Copy link
Collaborator

@fvaleri fvaleri commented Jan 20, 2023

This PR is based on #13131.

Output example:

$ bin/kafka-run-class.sh org.apache.kafka.tools.JmxTool \
  --jmx-url service:jmx:rmi:///jndi/rmi://:9990/jmxrmi \
  --object-name kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec \
  --attributes FifteenMinuteRate,FiveMinuteRate \
  --date-format "yyyyMMdd-hh:mm:ss" \
  --reporting-interval 1000 \
  --report-format tsv
Trying to connect to JMX url: service:jmx:rmi:///jndi/rmi://:9999/jmxrmi
time    20230120-06:23:14
kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec:FifteenMinuteRate    0.0
kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec:FiveMinuteRate	0.0
time	20230120-06:23:15
kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec:FifteenMinuteRate	0.0
kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec:FiveMinuteRate	0.0
time	20230120-06:23:16
kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec:FifteenMinuteRate	0.0
kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec:FiveMinuteRate	0.0
^C

System test using it:

$ TC_PATHS="tests/kafkatest/tests/core/throttling_test.py::ThrottlingTest.test_throttled_reassignment" \
  _DUCKTAPE_OPTIONS='--parameters '\''{"bounce_brokers":"false"}'\' \
    bash tests/docker/run_tests.sh
docker exec ducker01 bash -c "cd /opt/kafka-dev && ducktape --cluster-file /opt/kafka-dev/tests/docker/build/cluster.json  ./tests/kafkatest/tests/core/throttling_test.py::ThrottlingTest.test_throttled_reassignment --parameters '{"bounce_brokers":"false"}'"
/usr/local/lib/python3.9/dist-packages/paramiko/transport.py:236: CryptographyDeprecationWarning: Blowfish has been deprecated
  "class": algorithms.Blowfish,
[INFO:2023-01-21 09:21:39,367]: starting test run with session id 2023-01-21--017...
[INFO:2023-01-21 09:21:39,368]: running 1 tests...
[INFO:2023-01-21 09:21:39,368]: Triggering test 1 of 1...
[INFO:2023-01-21 09:21:39,373]: RunnerClient: Loading test {'directory': '/opt/kafka-dev/tests/kafkatest/tests/core', 'file_name': 'throttling_test.py', 'cls_name': 'ThrottlingTest', 'method_name': 'test_throttled_reassignment', 'injected_args': {'bounce_brokers': 'false'}}
[INFO:2023-01-21 09:21:39,375]: RunnerClient: kafkatest.tests.core.throttling_test.ThrottlingTest.test_throttled_reassignment.bounce_brokers=false: on run 1/1
[INFO:2023-01-21 09:21:39,376]: RunnerClient: kafkatest.tests.core.throttling_test.ThrottlingTest.test_throttled_reassignment.bounce_brokers=false: Setting up...
[INFO:2023-01-21 09:21:41,701]: RunnerClient: kafkatest.tests.core.throttling_test.ThrottlingTest.test_throttled_reassignment.bounce_brokers=false: Running...
[INFO:2023-01-21 09:26:23,770]: RunnerClient: kafkatest.tests.core.throttling_test.ThrottlingTest.test_throttled_reassignment.bounce_brokers=false: Tearing down...
[WARNING - 2023-01-21 09:26:24,090 - service_registry - stop_all - lineno:53]: Error stopping service <ProducerPerformanceService-0-139773137726720: num_nodes: 1, nodes: ['ducker09']>: 1
[INFO:2023-01-21 09:27:12,415]: RunnerClient: kafkatest.tests.core.throttling_test.ThrottlingTest.test_throttled_reassignment.bounce_brokers=false: PASS
[INFO:2023-01-21 09:27:12,415]: RunnerClient: kafkatest.tests.core.throttling_test.ThrottlingTest.test_throttled_reassignment.bounce_brokers=false: Data: None
================================================================================
SESSION REPORT (ALL TESTS)
ducktape version: 0.11.3
session_id:       2023-01-21--017
run time:         5 minutes 33.062 seconds
tests run:        1
passed:           1
flaky:            0
failed:           0
ignored:          0
================================================================================
test_id:    kafkatest.tests.core.throttling_test.ThrottlingTest.test_throttled_reassignment.bounce_brokers=false
status:     PASS
run time:   5 minutes 33.040 seconds
--------------------------------------------------------------------------------

@fvaleri fvaleri marked this pull request as draft January 20, 2023 16:56
@fvaleri fvaleri force-pushed the move-jmx-tool branch 2 times, most recently from 2e97c4a to 16b90df Compare January 20, 2023 17:31
@fvaleri fvaleri marked this pull request as ready for review January 21, 2023 14:54
@fvaleri fvaleri force-pushed the move-jmx-tool branch 2 times, most recently from 1b927c6 to b7daf79 Compare January 23, 2023 13:12
@fvaleri
Copy link
Collaborator Author

fvaleri commented Jan 24, 2023

@mimaison @clolov @vamossagar12 this is ready for review if you have some time.

Copy link
Member

@mimaison mimaison left a comment

Choose a reason for hiding this comment

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

Thanks @fvaleri for the PR. I left a few comments. I think we should use this opportunity to add a few tests too. Ideally write them against the previous tool first to ensure the new version works the same way.

checkstyle/import-control.xml Outdated Show resolved Hide resolved
core/src/main/scala/kafka/admin/ConsumerGroupCommand.scala Outdated Show resolved Hide resolved
tools/src/main/java/org/apache/kafka/tools/JmxCommand.java Outdated Show resolved Hide resolved
tools/src/main/java/org/apache/kafka/tools/JmxCommand.java Outdated Show resolved Hide resolved
@fvaleri
Copy link
Collaborator Author

fvaleri commented Jan 25, 2023

Thanks @mimaison.

I addressed all your comments and now working on the test suite.

…lasses

These classes are required by most commands, so they must be migrated first.

Signed-off-by: Federico Valeri <fedevaleri@gmail.com>
Signed-off-by: Federico Valeri <fedevaleri@gmail.com>
Signed-off-by: Federico Valeri <fedevaleri@gmail.com>
Signed-off-by: Federico Valeri <fedevaleri@gmail.com>
@fvaleri
Copy link
Collaborator Author

fvaleri commented Jan 27, 2023

@mimaison I've rebased and added some tests.

This is now ready for another review. Thanks.

Signed-off-by: Federico Valeri <fedevaleri@gmail.com>
Signed-off-by: Federico Valeri <fedevaleri@gmail.com>
Copy link
Member

@mimaison mimaison left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I left a few questions.

checkstyle/import-control.xml Show resolved Hide resolved
core/src/main/scala/kafka/Kafka.scala Outdated Show resolved Hide resolved
core/src/main/scala/kafka/admin/ConsumerGroupCommand.scala Outdated Show resolved Hide resolved
tools/src/main/java/org/apache/kafka/tools/JmxTool.java Outdated Show resolved Hide resolved
tools/src/main/java/org/apache/kafka/tools/JmxTool.java Outdated Show resolved Hide resolved
Signed-off-by: Federico Valeri <fedevaleri@gmail.com>
fvaleri and others added 2 commits February 1, 2023 18:12
Signed-off-by: Federico Valeri <fedevaleri@gmail.com>
Copy link
Member

@mimaison mimaison left a comment

Choose a reason for hiding this comment

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

LGTM

@mimaison mimaison merged commit 50e0e3c into apache:trunk Feb 2, 2023
@fvaleri fvaleri deleted the move-jmx-tool branch February 2, 2023 10:23
@ijuma
Copy link
Contributor

ijuma commented Feb 11, 2023

Looks like this caused some system test failures: http://confluent-kafka-system-test-results.s3-us-west-2.amazonaws.com/trunk/2023-02-11--001.system-test-kafka-trunk--1676126329--confluentinc--master--d0d9e3f297/report.html

TimeoutError('ubuntu@worker9: Jmx tool took too long to start')
Traceback (most recent call last):
File "/home/jenkins/workspace/system-test-kafka_trunk/kafka/venv/lib/python3.7/site-packages/ducktape-0.8.17-py3.7.egg/ducktape/tests/runner_client.py", line 184, in _do_run
data = self.run_test()
File "/home/jenkins/workspace/system-test-kafka_trunk/kafka/venv/lib/python3.7/site-packages/ducktape-0.8.17-py3.7.egg/ducktape/tests/runner_client.py", line 262, in run_test
return self.test_context.function(self.test)
File "/home/jenkins/workspace/system-test-kafka_trunk/kafka/venv/lib/python3.7/site-packages/ducktape-0.8.17-py3.7.egg/ducktape/mark/_mark.py", line 433, in wrapper
return functools.partial(f, *args, **kwargs)(*w_args, **w_kwargs)
File "/home/jenkins/workspace/system-test-kafka_trunk/kafka/tests/kafkatest/tests/client/quota_test.py", line 139, in test_quota
self.kafka.start()
File "/home/jenkins/workspace/system-test-kafka_trunk/kafka/tests/kafkatest/services/kafka/kafka.py", line 654, in start
self.wait_for_start(node, monitor, timeout_sec)
File "/home/jenkins/workspace/system-test-kafka_trunk/kafka/tests/kafkatest/services/kafka/kafka.py", line 890, in wait_for_start
self.start_jmx_tool(self.idx(node), node)
File "/home/jenkins/workspace/system-test-kafka_trunk/kafka/tests/kafkatest/services/monitor/jmx.py", line 90, in start_jmx_tool
wait_until(lambda: self._jmx_has_output(node), timeout_sec=30, backoff_sec=.5, err_msg="%s: Jmx tool took too long to start" % node.account)
File "/home/jenkins/workspace/system-test-kafka_trunk/kafka/venv/lib/python3.7/site-packages/ducktape-0.8.17-py3.7.egg/ducktape/utils/util.py", line 58, in wait_until
raise TimeoutError(err_msg() if callable(err_msg) else err_msg) from last_exception
ducktape.errors.TimeoutError: ubuntu@worker9: Jmx tool took too long to start

@fvaleri fvaleri added the tools label May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants