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

MINOR: disable JmxTool in kafkatest console-consumer by default #7785

Merged
merged 2 commits into from
Jan 10, 2020

Conversation

brianbushree
Copy link
Contributor

what

Provide the ability to optionally enable the JmxTool inside the kafkatest console-consumer

why

For tests that don't use these JMX metrics, we should allow users to disable this metrics collection.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@hachikuji hachikuji requested a review from mumrah December 5, 2019 20:03
@brianbushree
Copy link
Contributor Author

@hachikuji can you take another look please?

is this what you were thinking?

Copy link

@hachikuji hachikuji left a comment

Choose a reason for hiding this comment

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

Thanks, left a couple minor suggestions.

tests/kafkatest/services/console_consumer.py Outdated Show resolved Hide resolved
tests/kafkatest/services/console_consumer.py Outdated Show resolved Hide resolved
Copy link

@hachikuji hachikuji left a comment

Choose a reason for hiding this comment

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

@brianbushree Thanks, left a couple minor comments. Just to confirm, have you verified system tests are still passing with these changes? No need to check them all, maybe just make sure some test case which uses has_partitions_assigned (for example) still works.

tests/kafkatest/services/console_consumer.py Outdated Show resolved Hide resolved
tests/kafkatest/services/console_consumer.py Outdated Show resolved Hide resolved
@brianbushree
Copy link
Contributor Author

looks like I overlooked implementing proper default values with regard to inferring jmx_enabled from jmx_object_names/jmx_attributes...

currently we initialize the jmx_object_names and jmx_attributes here

self.jmx_object_names = ["kafka.consumer:type=consumer-coordinator-metrics,client-id=%s" % self.client_id]
self.jmx_attributes = ["assigned-partitions"]

if jmx_object_names is none (guessing we do this because the default value depends on another parameter, client-id)

unfortunately this means using jmx_object_names=None implies that we should use the default value...

seems like we have two options:

  1. stick with a simple jmx_enabled flag
  2. change the behavior of jmx_object_names such that we can pass in a string format and always replace %s with the client-id

@hachikuji what do you think? did I miss any other options?

@hachikuji
Copy link

I think the only reason we use the jmx tool by default is for the purpose of ConsoleConsumer.has_partitions_assigned. The only usage of this as far as I can tell is in produce_consume_validate.py and does not seem to be contributing significantly. I am thinking we can just remove this function and let the jmx tool be disabled by default. What do you think?

@brianbushree
Copy link
Contributor Author

Ya I agree completely. It makes sense to disable this by default since it seems there are only a few usages and makes this PR much more complicated. I'll remove this function and some of the associated logic.

@brianbushree brianbushree changed the base branch from 2.4 to trunk January 9, 2020 00:42
@@ -102,6 +100,10 @@ def __init__(self, context, num_nodes, kafka, topic, group_id="test-consumer-gro
for node in self.nodes:
node.version = version

self.jmx_tool = JmxTool(context, num_nodes=num_nodes,
jmx_object_names=jmx_object_names, jmx_attributes=(jmx_attributes or []),
root=ConsoleConsumer.PERSISTENT_ROOT)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mumrah to your earlier point, I've tried to avoid special casing by always initializing a JmxTool regardless of whether it'll be used

@hachikuji however, now that this is in place, it seems like we should maybe just stick with mixin approach since we're always initializing this object anyways? (this way we can also avoid some of the clean_node changes required here)

with that being said, I do like the consumer.jmx_tool namespace isolation

Choose a reason for hiding this comment

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

@brianbushree I don't mind going back to the mixin if you think that's better. I'll leave it up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this mixin approach is better for two reasons here:

  1. it should minimize this PR
  2. seems less like a one-off approach since we already use the mixin everywhere

I'm going to refactor this PR accordingly.

@brianbushree
Copy link
Contributor Author

brianbushree commented Jan 9, 2020

These are the tests that seem to rely on this jmx functionality in the consumer:

  • fetch_from_follower_test.py
  • streams_simple_benchmark_test.py
  • quota_test.py

I've tested these locally and they are passing (I also tested compression_test.py which does not rely on this jmx functionality)

@brianbushree brianbushree changed the title MINOR: optionally enable JmxTool in kafkatest console-consumer MINOR: disable JmxTool in kafkatest console-consumer by default Jan 10, 2020
Copy link

@hachikuji hachikuji left a comment

Choose a reason for hiding this comment

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

LGTM.

@hachikuji hachikuji merged commit 422bc1f into apache:trunk Jan 10, 2020
hachikuji pushed a commit that referenced this pull request Jan 10, 2020
Do not initialize `JmxTool` by default when running console consumer. In order to support this, we remove `has_partitions_assigned` and its only usage in an assertion inside `ProduceConsumeValidateTest`, which did not seem to contribute much to the validation.

Reviewers: David Arthur <[email protected]>, Jason Gustafson <[email protected]>
bbejeck pushed a commit that referenced this pull request Mar 1, 2020
what/why
the throttling_test was broken by this PR (#7785) since it depends on the consumer having partitions-assigned before starting the producer

this PR provides the ability to wait for partitions to be assigned in the console consumer before considering it started.

caveat
this does not support starting up the JmxTool inside the console-consumer for custom metrics while using this wait_until_partitions_assigned flag since the code assumes one JmxTool running per node.

I think a proper fix for this would be to make JmxTool its own standalone single-node service

alternatives
we could use the EndToEnd test suite which uses the verifiable producer/consumer under the hood but I found that there were more changes necessary to get this working unfortunately (specifically doesn't seem like this test suite plays nicely with the ProducerPerformanceService)

Reviewers: Mathew Wong <[email protected]>, Bill Bejeck <bbejeck.com>
bbejeck pushed a commit that referenced this pull request Mar 1, 2020
what/why
the throttling_test was broken by this PR (#7785) since it depends on the consumer having partitions-assigned before starting the producer

this PR provides the ability to wait for partitions to be assigned in the console consumer before considering it started.

caveat
this does not support starting up the JmxTool inside the console-consumer for custom metrics while using this wait_until_partitions_assigned flag since the code assumes one JmxTool running per node.

I think a proper fix for this would be to make JmxTool its own standalone single-node service

alternatives
we could use the EndToEnd test suite which uses the verifiable producer/consumer under the hood but I found that there were more changes necessary to get this working unfortunately (specifically doesn't seem like this test suite plays nicely with the ProducerPerformanceService)

Reviewers: Mathew Wong <[email protected]>, Bill Bejeck <bbejeck.com>
qq619618919 pushed a commit to qq619618919/kafka that referenced this pull request May 12, 2020
…he#7785)

Do not initialize `JmxTool` by default when running console consumer. In order to support this, we remove `has_partitions_assigned` and its only usage in an assertion inside `ProduceConsumeValidateTest`, which did not seem to contribute much to the validation.

Reviewers: David Arthur <[email protected]>, Jason Gustafson <[email protected]>
qq619618919 pushed a commit to qq619618919/kafka that referenced this pull request May 12, 2020
)

what/why
the throttling_test was broken by this PR (apache#7785) since it depends on the consumer having partitions-assigned before starting the producer

this PR provides the ability to wait for partitions to be assigned in the console consumer before considering it started.

caveat
this does not support starting up the JmxTool inside the console-consumer for custom metrics while using this wait_until_partitions_assigned flag since the code assumes one JmxTool running per node.

I think a proper fix for this would be to make JmxTool its own standalone single-node service

alternatives
we could use the EndToEnd test suite which uses the verifiable producer/consumer under the hood but I found that there were more changes necessary to get this working unfortunately (specifically doesn't seem like this test suite plays nicely with the ProducerPerformanceService)

Reviewers: Mathew Wong <[email protected]>, Bill Bejeck <bbejeck.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants