Class MetricSuppliers


  • public class MetricSuppliers
    extends Object
    Helper class for constructing instances of MetricRegistry.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 then SolrPluginUtils.invokeSetters(Object, Iterable, boolean) will be used for initialization.

    • Constructor Detail

      • MetricSuppliers

        public MetricSuppliers()
    • Method Detail

      • counterSupplier

        public static com.codahale.metrics.MetricRegistry.MetricSupplier<com.codahale.metrics.Counter> counterSupplier​(SolrResourceLoader loader,
                                                                                                                       PluginInfo info)
        Create a Counter supplier.
        Parameters:
        loader - resource loader
        info - 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 a Meter supplier.
        Parameters:
        loader - resource loader
        info - 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 a Timer supplier.
        Parameters:
        loader - resource loader
        info - 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 a Histogram supplier.
        Parameters:
        info - plugin configuration, or null for default
        Returns:
        configured supplier instance, or default instance if configuration was invalid
      • getNoOpGauge

        public static <T> com.codahale.metrics.Gauge<T> getNoOpGauge​(com.codahale.metrics.Gauge<T> actual)