From b6f6b021e59aa1f690d71c89c3404f9b794e385e Mon Sep 17 00:00:00 2001 From: Thomas Crowley Date: Thu, 19 Dec 2024 10:31:56 +1100 Subject: [PATCH] Document all MetricFilter mutation methods --- .../io/factorhouse/kpow/MetricFilter.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/java/io/factorhouse/kpow/MetricFilter.java b/src/java/io/factorhouse/kpow/MetricFilter.java index f870a22..f90978b 100644 --- a/src/java/io/factorhouse/kpow/MetricFilter.java +++ b/src/java/io/factorhouse/kpow/MetricFilter.java @@ -137,6 +137,11 @@ public List getFilters() { return Collections.unmodifiableList(filters); } + /** + * Accepts all metrics. + * + * @return an updated MetricFilter + */ public MetricFilter accept() { Predicate acceptPredicate = (_filter) -> { return true; @@ -146,12 +151,22 @@ public MetricFilter accept() { return this; } + /** + * Accepts a metric based on the specified Predicate. + * + * @return an updated MetricFilter + */ public MetricFilter accept(Predicate acceptFilter) { FilterCriteria criteria = new FilterCriteria(acceptFilter, FilterType.ACCEPT); this.filters.add(criteria); return this; } + /** + * Denies all metrics. + * + * @return an updated MetricFilter + */ public MetricFilter deny() { Predicate denyFilter = (_filter) -> { return true; @@ -161,12 +176,22 @@ public MetricFilter deny() { return this; } + /** + * Denies a metric based on the specified Predicate. + * + * @return an updated MetricFilter + */ public MetricFilter deny(Predicate denyFilter) { FilterCriteria criteria = new FilterCriteria(denyFilter, FilterType.DENY); this.filters.add(criteria); return this; } + /** + * Accepts all metrics whose name start with the specified prefix. + * + * @return an updated MetricFilter + */ public MetricFilter acceptNameStartsWith(String prefix) { Predicate acceptFilter = (metricName) -> { return metricName.name().startsWith(prefix); @@ -176,6 +201,11 @@ public MetricFilter acceptNameStartsWith(String prefix) { return this; } + /** + * Denies all metrics whose name start with the specified prefix. + * + * @return an updated MetricFilter + */ public MetricFilter denyNameStartsWith(String prefix) { Predicate denyFilter = (metricName) -> { return metricName.name().startsWith(prefix);