This is an automated email from the ASF dual-hosted git repository.
janhoy pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new 425ecb942cf Remove deprecated constructor in MetricsMap (#1567)
425ecb942cf is described below
commit 425ecb942cf63a95622e5473de6a22356f5cd8ad
Author: Jan Høydahl <[email protected]>
AuthorDate: Tue Apr 25 20:46:50 2023 +0200
Remove deprecated constructor in MetricsMap (#1567)
---
solr/CHANGES.txt | 2 +
.../java/org/apache/solr/metrics/MetricsMap.java | 11 --
.../org/apache/solr/util/stats/MetricUtils.java | 173 +--------------------
.../apache/solr/util/stats/MetricUtilsTest.java | 6 -
4 files changed, 4 insertions(+), 188 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index bbfaab75d04..620e95119a1 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -128,6 +128,8 @@ Other Changes
* SOLR-16735: Allow custom configuration of Jetty's SecureRequestCustomizer
(Tomás Fernández Löbbe)
+* PR#1567: Remove deprecated constructor in MetricsMap (janhoy)
+
* SOLR-16745: Consolidate DelegatedSolrQueryRequest and
DelegatingSolrQueryRequest (Kevin Risden)
================== 9.2.0 ==================
diff --git a/solr/core/src/java/org/apache/solr/metrics/MetricsMap.java
b/solr/core/src/java/org/apache/solr/metrics/MetricsMap.java
index 816b8c3a3f9..1e7aed8f8f2 100644
--- a/solr/core/src/java/org/apache/solr/metrics/MetricsMap.java
+++ b/solr/core/src/java/org/apache/solr/metrics/MetricsMap.java
@@ -68,17 +68,6 @@ public class MetricsMap implements Gauge<Map<String,
Object>>, MapWriter, Dynami
private Map<String, String> jmxAttributes;
private volatile Map<String, Object> cachedValue;
- /**
- * Create an instance that reports values to a Map.
- *
- * @param mapInitializer function to populate the Map result.
- * @deprecated use {@link #MetricsMap(MapWriter)} instead.
- */
- @Deprecated(since = "8.7")
- public MetricsMap(BiConsumer<Boolean, Map<String, Object>> mapInitializer) {
- this.mapInitializer = mapInitializer;
- }
-
/**
* Create an instance that reports values to a MapWriter.
*
diff --git a/solr/core/src/java/org/apache/solr/util/stats/MetricUtils.java
b/solr/core/src/java/org/apache/solr/util/stats/MetricUtils.java
index 8c186b0e38a..1cd548293df 100644
--- a/solr/core/src/java/org/apache/solr/util/stats/MetricUtils.java
+++ b/solr/core/src/java/org/apache/solr/util/stats/MetricUtils.java
@@ -86,28 +86,6 @@ public class MetricUtils {
static final String P999 = "p999";
static final String P999_MS = P999 + MS;
- /**
- * This filter can limit what properties of a metric are returned.
- *
- * @deprecated use {@link Predicate} instead.
- */
- @Deprecated(since = "8.7")
- public interface PropertyFilter {
- PropertyFilter ALL = (name) -> true;
-
- /**
- * Return only properties that match.
- *
- * @param name property name
- * @return true if this property should be returned, false otherwise.
- */
- boolean accept(String name);
-
- static Predicate<CharSequence> toPredicate(PropertyFilter filter) {
- return (name) -> filter.accept(name.toString());
- }
- }
-
public static final Predicate<CharSequence> ALL_PROPERTIES = (name) -> true;
/**
@@ -139,47 +117,6 @@ public class MetricUtils {
return ns / TimeUnit.MILLISECONDS.toNanos(1);
}
- /**
- * Provides a representation of the given metric registry as {@link
SolrInputDocument}-s. Only
- * those metrics are converted which match at least one of the given
MetricFilter instances.
- *
- * @param registry the {@link MetricRegistry} to be converted
- * @param shouldMatchFilters a list of {@link MetricFilter} instances. A
metric must match <em>any
- * one</em> of the filters from this list to be included in the output
- * @param mustMatchFilter a {@link MetricFilter}. A metric <em>must</em>
match this filter to be
- * included in the output.
- * @param propertyFilter limit what properties of a metric are returned
- * @param skipHistograms discard any {@link Histogram}-s and histogram parts
of {@link Timer}-s.
- * @param skipAggregateValues discard internal values of {@link
AggregateMetric}-s.
- * @param compact use compact representation for counters and gauges.
- * @param metadata optional metadata. If not null and not empty then this
map will be added under
- * a {@code _metadata_} key.
- * @param consumer consumer that accepts produced {@link SolrInputDocument}-s
- * @deprecated use {@link #toSolrInputDocuments(MetricRegistry, List,
MetricFilter, Predicate,
- * boolean, boolean, boolean, Map, Consumer)} instead.
- */
- @Deprecated(since = "8.7")
- public static void toSolrInputDocuments(
- MetricRegistry registry,
- List<MetricFilter> shouldMatchFilters,
- MetricFilter mustMatchFilter,
- PropertyFilter propertyFilter,
- boolean skipHistograms,
- boolean skipAggregateValues,
- boolean compact,
- Map<String, Object> metadata,
- Consumer<SolrInputDocument> consumer) {
- toSolrInputDocuments(
- registry,
- shouldMatchFilters,
- mustMatchFilter,
- PropertyFilter.toPredicate(propertyFilter),
- skipHistograms,
- skipAggregateValues,
- compact,
- metadata,
- consumer);
- }
/**
* Provides a representation of the given metric registry as {@link
SolrInputDocument}-s. Only
* those metrics are converted which match at least one of the given
MetricFilter instances.
@@ -261,7 +198,7 @@ public class MetricUtils {
writer.writeIter(
new IteratorWriter.ItemWriter() {
@Override
- public IteratorWriter.ItemWriter add(Object o) throws
IOException {
+ public IteratorWriter.ItemWriter add(Object o) {
consumer.accept(name, o);
return this;
}
@@ -275,44 +212,6 @@ public class MetricUtils {
}
}
- /**
- * Convert selected metrics to maps or to flattened objects.
- *
- * @param registry source of metrics
- * @param shouldMatchFilters metrics must match any of these filters
- * @param mustMatchFilter metrics must match this filter
- * @param propertyFilter limit what properties of a metric are returned
- * @param skipHistograms discard any {@link Histogram}-s and histogram parts
of {@link Timer}-s.
- * @param skipAggregateValues discard internal values of {@link
AggregateMetric}-s.
- * @param compact use compact representation for counters and gauges.
- * @param simple use simplified representation for complex metrics - instead
of a (name, map) only
- * the selected (name "." key, value) pairs will be produced.
- * @param consumer consumer that accepts produced objects
- * @deprecated use {@link #toMaps(MetricRegistry, List, MetricFilter,
Predicate, boolean, boolean,
- * boolean, boolean, BiConsumer)} instead.
- */
- @Deprecated(since = "8.7")
- public static void toMaps(
- MetricRegistry registry,
- List<MetricFilter> shouldMatchFilters,
- MetricFilter mustMatchFilter,
- PropertyFilter propertyFilter,
- boolean skipHistograms,
- boolean skipAggregateValues,
- boolean compact,
- boolean simple,
- BiConsumer<String, Object> consumer) {
- toMaps(
- registry,
- shouldMatchFilters,
- mustMatchFilter,
- PropertyFilter.toPredicate(propertyFilter),
- skipHistograms,
- skipAggregateValues,
- compact,
- simple,
- consumer);
- }
/**
* Convert selected metrics to maps or to flattened objects.
*
@@ -406,7 +305,7 @@ public class MetricUtils {
convertMetric(
n,
metric,
- PropertyFilter.ALL,
+ (s) -> true,
skipHistograms,
skipAggregateValues,
compact,
@@ -416,43 +315,6 @@ public class MetricUtils {
});
}
- /**
- * Convert a single instance of metric into a map or flattened object.
- *
- * @param n metric name
- * @param metric metric instance
- * @param propertyFilter limit what properties of a metric are returned
- * @param skipHistograms discard any {@link Histogram}-s and histogram parts
of {@link Timer}-s.
- * @param skipAggregateValues discard internal values of {@link
AggregateMetric}-s.
- * @param compact use compact representation for counters and gauges.
- * @param simple use simplified representation for complex metrics - instead
of a (name, map) only
- * the selected (name "." key, value) pairs will be produced.
- * @param consumer consumer that accepts produced objects
- * @deprecated use {@link #convertMetric(String, Metric, Predicate, boolean,
boolean, boolean,
- * boolean, String, BiConsumer)} instead.
- */
- @Deprecated(since = "8.7")
- public static void convertMetric(
- String n,
- Metric metric,
- PropertyFilter propertyFilter,
- boolean skipHistograms,
- boolean skipAggregateValues,
- boolean compact,
- boolean simple,
- String separator,
- BiConsumer<String, Object> consumer) {
- convertMetric(
- n,
- metric,
- PropertyFilter.toPredicate(propertyFilter),
- skipHistograms,
- skipAggregateValues,
- compact,
- simple,
- separator,
- consumer);
- }
/**
* Convert a single instance of metric into a map or flattened object.
*
@@ -656,37 +518,6 @@ public class MetricUtils {
filter.accept((ms ? P999_MS : P999), nsToMs(ms,
snapshot.get999thPercentile()));
}
- /**
- * Convert a {@link Timer} to a map.
- *
- * @param name metric name
- * @param timer timer instance
- * @param propertyFilter limit what properties of a metric are returned
- * @param skipHistograms if true then discard the histogram part of the
timer.
- * @param simple use simplified representation for complex metrics - instead
of a (name, map) only
- * the selected (name "." key, value) pairs will be produced.
- * @param consumer consumer that accepts produced objects
- * @deprecated use {@link #convertTimer(String, Timer, Predicate, boolean,
boolean, String,
- * BiConsumer)} instead.
- */
- @Deprecated(since = "8.7")
- public static void convertTimer(
- String name,
- Timer timer,
- PropertyFilter propertyFilter,
- boolean skipHistograms,
- boolean simple,
- String separator,
- BiConsumer<String, Object> consumer) {
- convertTimer(
- name,
- timer,
- PropertyFilter.toPredicate(propertyFilter),
- skipHistograms,
- simple,
- separator,
- consumer);
- }
/**
* Convert a {@link Timer} to a map.
*
diff --git a/solr/core/src/test/org/apache/solr/util/stats/MetricUtilsTest.java
b/solr/core/src/test/org/apache/solr/util/stats/MetricUtilsTest.java
index 51dd2c6dc7f..a7f0838c05c 100644
--- a/solr/core/src/test/org/apache/solr/util/stats/MetricUtilsTest.java
+++ b/solr/core/src/test/org/apache/solr/util/stats/MetricUtilsTest.java
@@ -114,12 +114,6 @@ public class MetricUtilsTest extends SolrTestCaseJ4 {
};
registry.register("memory.expected.error", error);
- MetricsMap metricsMapWithMap =
- new MetricsMap(
- (detailed, map) -> {
- map.put("foo", "bar");
- });
- registry.register("mapWithMap", metricsMapWithMap);
MetricsMap metricsMap =
new MetricsMap(
map -> {