-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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-3711: Ensure a RecordingMap is passed to configured instances #1479
Conversation
LGTM. I'll let @ewencp check as well since he suggested the change. |
This seems fine for the specific issue. A few things:
3 could easily be left to a separate JIRA (Connect is the only user of this at the moment, although increasingly I think we should be adopting the approach to avoid a lot of this mess of shared namespaces and trying to track shared usage of configs). |
@ewencp, the issue with assigning Good catch about |
@ijuma Ah, that makes sense. I'm actually ok with it as is, we just have to take care when adding anything to this class. It's relatively low churn these days, so it's not a huge concern to me. However, we definitely should have a unit test. |
I will work on adding a unit test. I'll also take a look at |
This should be ready for review again. Pushed two commits that add tests and allow RecordingMap to handle a prefix. |
if (key instanceof String) | ||
ignore((String) key); | ||
if (key instanceof String) { | ||
String keyWithPrefix = prefix + key; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably avoid string concatenation if prefix.isEmpty
(since it's the common case).
keyWithPrefix = (String) key; | ||
} else { | ||
keyWithPrefix = prefix + key; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now check prefix.isEmpty()
here to avoid concatentation in most cases and save a String allocation, as suggested by @ijuma
LGTM |
LGTM! |
See https://issues.apache.org/jira/browse/KAFKA-3711
I've tested locally that this change does indeed resolve the warning I mention in the ticket:
where
metric.dropwizard.registry
is a configuration value defined in a customMetricReporter
(https://github.com/SimpleFinance/kafka-dropwizard-reporter).With this change, the above warning no longer appears, as @ewencp predicted.
This contribution is my original work and I license the work to the project under the project's open source license.