-
Notifications
You must be signed in to change notification settings - Fork 53
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
Change filtering rules behavior #48
Change filtering rules behavior #48
Conversation
Filtering rules now mimic the behavior of iptables firewall rules. The last applicable rule wins.
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.
Just a couple of nit-pick suggestions that don't have to be addressed. Approved as-is or with the minor changes made.
logger.info("Metric {}", name); | ||
logger.info(">>>>>> Applying rule {}", lastRule.get()); |
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.
Maybe make these DEBUG level logs. I don't have a very strong opinion here, so if you still want them to be INFO, I could be easily convinced.
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.
You're right, I moved them to debug level. I also enclosed the block under a if (logging.isDebugLevel()) {
to avoid the additional calls when we're at INFO level.
Assert.assertFalse(FilteringRule.applyFilters("org.apache.cassandra.metrics.metric1", Arrays.asList(unaffectedByDenyRule, firstRule, secondRule, thirdRule)).isAllowRule); | ||
Assert.assertTrue(FilteringRule.applyFilters("org.apache.cassandra.metrics.metric2", Arrays.asList(unaffectedByDenyRule, firstRule, secondRule, thirdRule)).isAllowRule); | ||
Assert.assertTrue(FilteringRule.applyFilters("org.apache.cassandra.whatever.metric3", Arrays.asList(unaffectedByDenyRule, firstRule, secondRule, thirdRule)).isAllowRule); |
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: You could extract the List of rules once, and use it in each of the assert statements, as opposed to using Arrays.asList
each time. But this is a test, so the efficiency is not really a big deal.
0219252
to
aa52a78
Compare
This PR changes the way metrics filtering rules are applied. It mimics how firewall rules are applied by iptables, where the last rule wins.
It allows to deny a whole group of metrics and then allow only specific ones, without affecting other metric groups.
As this is a breaking change, the version number was bumped accordingly.