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.MetricSupplierbased on plugin configuration. This allows us to customize eg.Reservoirimplementations and parameters for timers and histograms.Custom supplier implementations must provide a zero-args constructor, and may optionally implement PluginInfoInitializedinterface for configuration - if they don't thenSolrPluginUtils.invokeSetters(Object, Iterable, boolean)will be used for initialization.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classMetricSuppliers.DefaultCounterSupplierDefaultCountersupplier.static classMetricSuppliers.DefaultHistogramSupplierDefault supplier ofHistograminstances, with configurable reservoir.static classMetricSuppliers.DefaultMeterSupplierDefaultMetersupplier.static classMetricSuppliers.DefaultTimerSupplierDefault supplier ofTimerinstances, with configurable clock and reservoir.static classMetricSuppliers.NoOpCounterSupplierNo-op implementation ofCountersupplier.static classMetricSuppliers.NoOpGaugeNo-op implementation ofGauge.static classMetricSuppliers.NoOpHistogramSupplierNo-op implementation ofHistogramsupplier.static classMetricSuppliers.NoOpMeterSupplierNo-op implementation ofMetersupplier.static interfaceMetricSuppliers.NoOpMetricMarker interface for all no-op metrics.static classMetricSuppliers.NoOpTimerSupplierNo-op implementation ofTimersupplier.
 - 
Field SummaryFields Modifier and Type Field Description static StringCLOCKClock type parameter.static StringCLOCK_CPUCPU-time clock.static StringCLOCK_USERUser-time clock.static StringRESERVOIRImplementation class, must implementReservoir.static StringRESERVOIR_EDR_ALPHAAlpha parameter ofExponentiallyDecayingReservoir.static StringRESERVOIR_SIZESize of reservoir.static StringRESERVOIR_WINDOWTime window in seconds ofSlidingTimeWindowReservoir.
 - 
Constructor SummaryConstructors Constructor Description MetricSuppliers()
 - 
Method SummaryAll 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 aCountersupplier.static com.codahale.metrics.ClockgetClock(PluginInfo info, String param)static <T> com.codahale.metrics.Gauge<T>getNoOpGauge(com.codahale.metrics.Gauge<T> actual)static com.codahale.metrics.MetricRegistry.MetricSupplier<com.codahale.metrics.Histogram>histogramSupplier(SolrResourceLoader loader, PluginInfo info)Create aHistogramsupplier.static com.codahale.metrics.MetricRegistry.MetricSupplier<com.codahale.metrics.Meter>meterSupplier(SolrResourceLoader loader, PluginInfo info)Create aMetersupplier.static com.codahale.metrics.MetricRegistry.MetricSupplier<com.codahale.metrics.Timer>timerSupplier(SolrResourceLoader loader, PluginInfo info)Create aTimersupplier.
 
- 
- 
- 
Field Detail- 
CLOCKpublic static final String CLOCK Clock type parameter.- See Also:
- Constant Field Values
 
 - 
CLOCK_USERpublic static final String CLOCK_USER User-time clock.- See Also:
- Constant Field Values
 
 - 
CLOCK_CPUpublic static final String CLOCK_CPU CPU-time clock.- See Also:
- Constant Field Values
 
 - 
RESERVOIRpublic 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_SIZEpublic static final String RESERVOIR_SIZE Size of reservoir.- See Also:
- Constant Field Values
 
 - 
RESERVOIR_EDR_ALPHApublic static final String RESERVOIR_EDR_ALPHA Alpha parameter ofExponentiallyDecayingReservoir.- See Also:
- Constant Field Values
 
 - 
RESERVOIR_WINDOWpublic static final String RESERVOIR_WINDOW Time window in seconds ofSlidingTimeWindowReservoir.- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getClockpublic static com.codahale.metrics.Clock getClock(PluginInfo info, String param) 
 - 
counterSupplierpublic static com.codahale.metrics.MetricRegistry.MetricSupplier<com.codahale.metrics.Counter> counterSupplier(SolrResourceLoader loader, PluginInfo info) Create aCountersupplier.- Parameters:
- loader- resource loader
- info- plugin configuration, or null for default
- Returns:
- configured supplier instance, or default instance if configuration was invalid
 
 - 
meterSupplierpublic static com.codahale.metrics.MetricRegistry.MetricSupplier<com.codahale.metrics.Meter> meterSupplier(SolrResourceLoader loader, PluginInfo info) Create aMetersupplier.- Parameters:
- loader- resource loader
- info- plugin configuration, or null for default
- Returns:
- configured supplier instance, or default instance if configuration was invalid
 
 - 
timerSupplierpublic static com.codahale.metrics.MetricRegistry.MetricSupplier<com.codahale.metrics.Timer> timerSupplier(SolrResourceLoader loader, PluginInfo info) Create aTimersupplier.- Parameters:
- loader- resource loader
- info- plugin configuration, or null for default
- Returns:
- configured supplier instance, or default instance if configuration was invalid
 
 - 
histogramSupplierpublic static com.codahale.metrics.MetricRegistry.MetricSupplier<com.codahale.metrics.Histogram> histogramSupplier(SolrResourceLoader loader, PluginInfo info) Create aHistogramsupplier.- Parameters:
- info- plugin configuration, or null for default
- Returns:
- configured supplier instance, or default instance if configuration was invalid
 
 - 
getNoOpGaugepublic static <T> com.codahale.metrics.Gauge<T> getNoOpGauge(com.codahale.metrics.Gauge<T> actual) 
 
- 
 
-