Class AveragingMetricProvider
- java.lang.Object
-
- org.apache.solr.util.circuitbreaker.AveragingMetricProvider
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class AveragingMetricProvider extends Object implements Closeable
Averages the metric value over a period of time
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAveragingMetricProvider.MetricProviderInterface to provide the metric value.
-
Constructor Summary
Constructors Constructor Description AveragingMetricProvider(AveragingMetricProvider.MetricProvider metricProvider, int numSamples, long sampleInterval)Creates an instance with an executor that runs every sampleInterval seconds and averages over numSamples samples.
-
-
-
Constructor Detail
-
AveragingMetricProvider
public AveragingMetricProvider(AveragingMetricProvider.MetricProvider metricProvider, int numSamples, long sampleInterval)
Creates an instance with an executor that runs every sampleInterval seconds and averages over numSamples samples.- Parameters:
metricProvider- metric provider that will provide a valuenumSamples- number of samples to calculate average forsampleInterval- interval between each sample
-
-
Method Detail
-
getMetricValue
public double getMetricValue()
Return current average. This is a cached value, so calling this method will not incur any calculations
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-