Package org.apache.solr.metrics
Class MetricSuppliers
- java.lang.Object
-
- org.apache.solr.metrics.MetricSuppliers
-
public class MetricSuppliers extends Object
Helper class for constructing instances ofMetricRegistry.MetricSupplier
based on plugin configuration. This allows us to customize eg.Reservoir
implementations and parameters for timers and histograms.Custom supplier implementations must provide a zero-args constructor, and may optionally implement
PluginInfoInitialized
interface for configuration - if they don't thenSolrPluginUtils.invokeSetters(Object, Iterable, boolean)
will be used for initialization.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MetricSuppliers.DefaultCounterSupplier
DefaultCounter
supplier.static class
MetricSuppliers.DefaultHistogramSupplier
Default supplier ofHistogram
instances, with configurable reservoir.static class
MetricSuppliers.DefaultMeterSupplier
DefaultMeter
supplier.static class
MetricSuppliers.DefaultTimerSupplier
Default supplier ofTimer
instances, with configurable clock and reservoir.
-
Field Summary
Fields Modifier and Type Field Description static String
CLOCK
Clock type parameter.static String
CLOCK_CPU
CPU-time clock.static String
CLOCK_USER
User-time clock.static String
RESERVOIR
Implementation class, must implementReservoir
.static String
RESERVOIR_EDR_ALPHA
Alpha parameter ofExponentiallyDecayingReservoir
.static String
RESERVOIR_SIZE
Size of reservoir.static String
RESERVOIR_WINDOW
Time window in seconds ofSlidingTimeWindowReservoir
.
-
Constructor Summary
Constructors Constructor Description MetricSuppliers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.codahale.metrics.MetricRegistry.MetricSupplier<com.codahale.metrics.Counter>
counterSupplier(SolrResourceLoader loader, PluginInfo info)
Create aCounter
supplier.static com.codahale.metrics.MetricRegistry.MetricSupplier<com.codahale.metrics.Histogram>
histogramSupplier(SolrResourceLoader loader, PluginInfo info)
Create aHistogram
supplier.static com.codahale.metrics.MetricRegistry.MetricSupplier<com.codahale.metrics.Meter>
meterSupplier(SolrResourceLoader loader, PluginInfo info)
Create aMeter
supplier.static com.codahale.metrics.MetricRegistry.MetricSupplier<com.codahale.metrics.Timer>
timerSupplier(SolrResourceLoader loader, PluginInfo info)
Create aTimer
supplier.
-
-
-
Field Detail
-
CLOCK
public static final String CLOCK
Clock type parameter.- See Also:
- Constant Field Values
-
CLOCK_USER
public static final String CLOCK_USER
User-time clock.- See Also:
- Constant Field Values
-
CLOCK_CPU
public static final String CLOCK_CPU
CPU-time clock.- See Also:
- Constant Field Values
-
RESERVOIR
public static final String RESERVOIR
Implementation class, must implementReservoir
. Supports non-standard configuration of the implementations available in metrics-core.- See Also:
- Constant Field Values
-
RESERVOIR_SIZE
public static final String RESERVOIR_SIZE
Size of reservoir.- See Also:
- Constant Field Values
-
RESERVOIR_EDR_ALPHA
public static final String RESERVOIR_EDR_ALPHA
Alpha parameter ofExponentiallyDecayingReservoir
.- See Also:
- Constant Field Values
-
RESERVOIR_WINDOW
public static final String RESERVOIR_WINDOW
Time window in seconds ofSlidingTimeWindowReservoir
.- See Also:
- Constant Field Values
-
-
Method Detail
-
counterSupplier
public static com.codahale.metrics.MetricRegistry.MetricSupplier<com.codahale.metrics.Counter> counterSupplier(SolrResourceLoader loader, PluginInfo info)
Create aCounter
supplier.- Parameters:
loader
- resource loaderinfo
- plugin configuration, or null for default- Returns:
- configured supplier instance, or default instance if configuration was invalid
-
meterSupplier
public static com.codahale.metrics.MetricRegistry.MetricSupplier<com.codahale.metrics.Meter> meterSupplier(SolrResourceLoader loader, PluginInfo info)
Create aMeter
supplier.- Parameters:
loader
- resource loaderinfo
- plugin configuration, or null for default- Returns:
- configured supplier instance, or default instance if configuration was invalid
-
timerSupplier
public static com.codahale.metrics.MetricRegistry.MetricSupplier<com.codahale.metrics.Timer> timerSupplier(SolrResourceLoader loader, PluginInfo info)
Create aTimer
supplier.- Parameters:
loader
- resource loaderinfo
- plugin configuration, or null for default- Returns:
- configured supplier instance, or default instance if configuration was invalid
-
histogramSupplier
public static com.codahale.metrics.MetricRegistry.MetricSupplier<com.codahale.metrics.Histogram> histogramSupplier(SolrResourceLoader loader, PluginInfo info)
Create aHistogram
supplier.- Parameters:
info
- plugin configuration, or null for default- Returns:
- configured supplier instance, or default instance if configuration was invalid
-
-