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
,CumulativeHistogramLongTaskTimer
,CumulativeTimer
,DefaultGauge
,DefaultLongTaskTimer
,DefaultMeter
,DropwizardCounter
,DropwizardDistributionSummary
,DropwizardFunctionCounter
,DropwizardFunctionTimer
,DropwizardGauge
,DropwizardTimer
,NoopCounter
,NoopDistributionSummary
,NoopFunctionCounter
,NoopFunctionTimer
,NoopGauge
,NoopLongTaskTimer
,NoopMeter
,NoopTimeGauge
,NoopTimer
,StepCounter
,StepDistributionSummary
,StepFunctionCounter
,StepFunctionTimer
,StepTimer
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Fluent builder for custom meters.static class
A meter is uniquely identified by its combination of name and tags.static class
Custom meters may emit metrics like one of these types without implementing the corresponding interface. -
Method Summary
Modifier and TypeMethodDescriptionstatic Meter.Builder
builder(String name, Meter.Type type, Iterable<Measurement> measurements)
default void
close()
getId()
default <T> T
match(Function<Gauge,T> visitGauge, Function<Counter,T> visitCounter, Function<Timer,T> visitTimer, Function<DistributionSummary,T> visitSummary, Function<LongTaskTimer,T> visitLongTaskTimer, Function<TimeGauge,T> visitTimeGauge, Function<FunctionCounter,T> visitFunctionCounter, Function<FunctionTimer,T> visitFunctionTimer, Function<Meter,T> visitMeter)
measure()
Get a set of measurements.default void
use(Consumer<Gauge> visitGauge, Consumer<Counter> visitCounter, Consumer<Timer> visitTimer, Consumer<DistributionSummary> visitSummary, Consumer<LongTaskTimer> visitLongTaskTimer, Consumer<TimeGauge> visitTimeGauge, Consumer<FunctionCounter> visitFunctionCounter, Consumer<FunctionTimer> visitFunctionTimer, Consumer<Meter> visitMeter)
-
Method Details
-
builder
-
getId
Meter.Id getId()- Returns:
- A unique combination of name and tags
-
measure
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(Function<Gauge,T> visitGauge, Function<Counter,T> visitCounter, Function<Timer,T> visitTimer, Function<DistributionSummary,T> visitSummary, Function<LongTaskTimer,T> visitLongTaskTimer, Function<TimeGauge,T> visitTimeGauge, Function<FunctionCounter,T> visitFunctionCounter, Function<FunctionTimer,T> visitFunctionTimer, Function<Meter,T> visitMeter)Match aMeter
by type with series of dedicated functions for specificMeter
s and return a result from the matched function.NOTE: This method contract will change in minor releases if ever a new
Meter
type 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 newMeter
indicates 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 forGauge
visitCounter
- function to apply forCounter
visitTimer
- function to apply forTimer
visitSummary
- function to apply forDistributionSummary
visitLongTaskTimer
- function to apply forLongTaskTimer
visitTimeGauge
- function to apply forTimeGauge
visitFunctionCounter
- function to apply forFunctionCounter
visitFunctionTimer
- function to apply forFunctionTimer
visitMeter
- function to apply as a fallback- Returns:
- return value from the applied function
- Since:
- 1.1.0
-
use
default void use(Consumer<Gauge> visitGauge, Consumer<Counter> visitCounter, Consumer<Timer> visitTimer, Consumer<DistributionSummary> visitSummary, Consumer<LongTaskTimer> visitLongTaskTimer, Consumer<TimeGauge> visitTimeGauge, Consumer<FunctionCounter> visitFunctionCounter, Consumer<FunctionTimer> visitFunctionTimer, Consumer<Meter> visitMeter)Match aMeter
with a series of dedicated functions for specificMeter
s and call the matching consumer.NOTE: This method contract will change in minor releases if ever a new
Meter
type 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 newMeter
indicates 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 forGauge
visitCounter
- function to apply forCounter
visitTimer
- function to apply forTimer
visitSummary
- function to apply forDistributionSummary
visitLongTaskTimer
- function to apply forLongTaskTimer
visitTimeGauge
- function to apply forTimeGauge
visitFunctionCounter
- function to apply forFunctionCounter
visitFunctionTimer
- function to apply forFunctionTimer
visitMeter
- function to apply as a fallback- Since:
- 1.1.0
-
close
default void close()
-