Interface Meter
-
- All Known Subinterfaces:
Counter,DistributionSummary,FunctionCounter,FunctionTimer,Gauge,HistogramSupport,LongTaskTimer,TimeGauge,Timer
- All Known Implementing Classes:
AbstractDistributionSummary,AbstractMeter,AbstractTimer,CompositeFunctionCounter,CumulativeCounter,CumulativeDistributionSummary,CumulativeFunctionCounter,CumulativeFunctionTimer,CumulativeTimer,DefaultGauge,DefaultLongTaskTimer,DefaultMeter,DropwizardCounter,DropwizardDistributionSummary,DropwizardFunctionCounter,DropwizardFunctionTimer,DropwizardGauge,DropwizardTimer,NoopCounter,NoopDistributionSummary,NoopFunctionCounter,NoopFunctionTimer,NoopGauge,NoopLongTaskTimer,NoopMeter,NoopTimeGauge,NoopTimer,StepCounter,StepDistributionSummary,StepFunctionCounter,StepFunctionTimer,StepTimer
public interface MeterA named and dimensioned producer of one or more measurements.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classMeter.BuilderFluent builder for custom meters.static classMeter.IdA meter is uniquely identified by its combination of name and tags.static classMeter.TypeCustom meters may emit metrics like one of these types without implementing the corresponding interface.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static Meter.Builderbuilder(java.lang.String name, Meter.Type type, java.lang.Iterable<Measurement> measurements)default voidclose()Meter.IdgetId()default <T> Tmatch(java.util.function.Function<Gauge,T> visitGauge, java.util.function.Function<Counter,T> visitCounter, java.util.function.Function<Timer,T> visitTimer, java.util.function.Function<DistributionSummary,T> visitSummary, java.util.function.Function<LongTaskTimer,T> visitLongTaskTimer, java.util.function.Function<TimeGauge,T> visitTimeGauge, java.util.function.Function<FunctionCounter,T> visitFunctionCounter, java.util.function.Function<FunctionTimer,T> visitFunctionTimer, java.util.function.Function<Meter,T> visitMeter)java.lang.Iterable<Measurement>measure()Get a set of measurements.default voiduse(java.util.function.Consumer<Gauge> visitGauge, java.util.function.Consumer<Counter> visitCounter, java.util.function.Consumer<Timer> visitTimer, java.util.function.Consumer<DistributionSummary> visitSummary, java.util.function.Consumer<LongTaskTimer> visitLongTaskTimer, java.util.function.Consumer<TimeGauge> visitTimeGauge, java.util.function.Consumer<FunctionCounter> visitFunctionCounter, java.util.function.Consumer<FunctionTimer> visitFunctionTimer, java.util.function.Consumer<Meter> visitMeter)
-
-
-
Method Detail
-
builder
static Meter.Builder builder(java.lang.String name, Meter.Type type, java.lang.Iterable<Measurement> measurements)
-
getId
Meter.Id getId()
- Returns:
- A unique combination of name and tags
-
measure
java.lang.Iterable<Measurement> measure()
Get a set of measurements. Should always return the same number of measurements and in the same order, regardless of the level of activity or the lack thereof.- Returns:
- The set of measurements that represents the instantaneous value of this meter.
-
match
default <T> T match(java.util.function.Function<Gauge,T> visitGauge, java.util.function.Function<Counter,T> visitCounter, java.util.function.Function<Timer,T> visitTimer, java.util.function.Function<DistributionSummary,T> visitSummary, java.util.function.Function<LongTaskTimer,T> visitLongTaskTimer, java.util.function.Function<TimeGauge,T> visitTimeGauge, java.util.function.Function<FunctionCounter,T> visitFunctionCounter, java.util.function.Function<FunctionTimer,T> visitFunctionTimer, java.util.function.Function<Meter,T> visitMeter)
Match aMeterby type with series of dedicated functions for specificMeters and return a result from the matched function.NOTE: This method contract will change in minor releases if ever a new
Metertype is created. In this case only, this is considered a feature. By using this method, you are declaring that you want to be sure to handle all types of meters. A breaking API change during the introduction of a newMeterindicates that there is a new meter type for you to consider and the compiler will effectively require you to consider it.- Type Parameters:
T- return type of function to apply- Parameters:
visitGauge- function to apply forGaugevisitCounter- function to apply forCountervisitTimer- function to apply forTimervisitSummary- function to apply forDistributionSummaryvisitLongTaskTimer- function to apply forLongTaskTimervisitTimeGauge- function to apply forTimeGaugevisitFunctionCounter- function to apply forFunctionCountervisitFunctionTimer- function to apply forFunctionTimervisitMeter- function to apply as a fallback- Returns:
- return value from the applied function
- Since:
- 1.1.0
-
use
default void use(java.util.function.Consumer<Gauge> visitGauge, java.util.function.Consumer<Counter> visitCounter, java.util.function.Consumer<Timer> visitTimer, java.util.function.Consumer<DistributionSummary> visitSummary, java.util.function.Consumer<LongTaskTimer> visitLongTaskTimer, java.util.function.Consumer<TimeGauge> visitTimeGauge, java.util.function.Consumer<FunctionCounter> visitFunctionCounter, java.util.function.Consumer<FunctionTimer> visitFunctionTimer, java.util.function.Consumer<Meter> visitMeter)
Match aMeterwith a series of dedicated functions for specificMeters and call the matching consumer.NOTE: This method contract will change in minor releases if ever a new
Metertype is created. In this case only, this is considered a feature. By using this method, you are declaring that you want to be sure to handle all types of meters. A breaking API change during the introduction of a newMeterindicates that there is a new meter type for you to consider and the compiler will effectively require you to consider it.- Parameters:
visitGauge- function to apply forGaugevisitCounter- function to apply forCountervisitTimer- function to apply forTimervisitSummary- function to apply forDistributionSummaryvisitLongTaskTimer- function to apply forLongTaskTimervisitTimeGauge- function to apply forTimeGaugevisitFunctionCounter- function to apply forFunctionCountervisitFunctionTimer- function to apply forFunctionTimervisitMeter- function to apply as a fallback- Since:
- 1.1.0
-
close
default void close()
-
-