-
Notifications
You must be signed in to change notification settings - Fork 14.3k
KAFKA-19139 Plugin#wrapInstance should use LinkedHashMap instead of Map #19519
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
base: trunk
Are you sure you want to change the base?
Conversation
Good. Using LinkedHashMap makes sense here to ensure consistent tag ordering and avoid duplicate time series in metrics backends. The trade-off is acceptable since this is not on a performance-critical path. |
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.
@m1a2st: Thanks for the patch.
Could you please check the modified files and eliminate the double brace initialization?
private static final LinkedHashMap<String, String> TAGS = new LinkedHashMap<>() {{ | ||
put("k", "v"); | ||
}}; |
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.
nit: Could we use a static block instead of double brace initialization?
There will be an update to the PluginMetrics#metricName method: the type
of the tags parameter will be changed
from Map to LinkedHashMap.
This change is necessary because the order of metric tags is important
distinct ones by the metrics backend
consistency, we should follow the same approach here.