Package io.micrometer.core.instrument
Interface Gauge
- All Superinterfaces:
Meter
- All Known Subinterfaces:
TimeGauge
- All Known Implementing Classes:
DefaultGauge
,DropwizardGauge
,NoopGauge
,NoopTimeGauge
A gauge tracks a value that may go up or down. The value that is published for gauges
is an instantaneous sample of the gauge at publishing time.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micrometer.core.instrument.Meter
Meter.Id, Meter.MeterProvider<T extends Meter>, Meter.Type
-
Method Summary
Modifier and TypeMethodDescriptionstatic Gauge.Builder
<Supplier<Number>> A convenience method for building a gauge from a supplying function, holding a strong reference to this function.static <T> Gauge.Builder
<T> builder
(String name, T obj, ToDoubleFunction<T> f) default Iterable
<Measurement> measure()
Get a set of measurements.double
value()
The act of observing the value by calling this method triggers sampling of the underlying number or user-defined function that defines the value for the gauge.
-
Method Details
-
builder
- Type Parameters:
T
- The type of object to gauge.- Parameters:
name
- The gauge's name.obj
- An object with some state or function which the gauge's instantaneous value is determined from.f
- A function that yields a double value for the gauge, based on the state ofobj
.- Returns:
- A new gauge builder.
-
builder
@Incubating(since="1.1.0") static Gauge.Builder<Supplier<Number>> builder(String name, Supplier<Number> f) A convenience method for building a gauge from a supplying function, holding a strong reference to this function.- Parameters:
name
- The gauge's name.f
- A function that yields a double value for the gauge.- Returns:
- A new gauge builder.
- Since:
- 1.1.0
-
value
double value()The act of observing the value by calling this method triggers sampling of the underlying number or user-defined function that defines the value for the gauge.- Returns:
- The current value.
-
measure
Description copied from interface:Meter
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.
-