bipinprasad commented on a change in pull request #3371:
URL: https://github.com/apache/storm/pull/3371#discussion_r556168871
##########
File path:
storm-client/src/jvm/org/apache/storm/metrics2/StormMetricRegistry.java
##########
@@ -432,4 +450,35 @@ public void run() {
}
}
}
+
+ private static class RemoveMetricFilter implements MetricFilter {
+ private Set<Metric> metrics = new HashSet<>();
+
+ RemoveMetricFilter(Set<Metric> toRemove) {
+ this.metrics.addAll(toRemove);
+ for (Metric metric : toRemove) {
+ // RateCounters are gauges, but also have internal Counters
that should also be removed
+ if (metric instanceof RateCounter) {
+ RateCounter rateCounter = (RateCounter) metric;
+ this.metrics.add(rateCounter.getCounter());
+ }
+ }
+ }
+
+ /**
+ * Returns {@code true} if the metric matches the filter; {@code
false} otherwise.
+ *
+ * @param name the metric's name
+ * @param metric the metric
+ * @return {@code true} if the metric matches the filter
+ */
+ @Override
+ public boolean matches(String name, Metric metric) {
+ if (this.metrics.contains(metric)) {
Review comment:
nit: superfluous conditional: replace with return
this.metrics.contains(metric)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]