Package io.micrometer.core.instrument
Interface TimeGauge
- All Known Implementing Classes:
NoopTimeGauge
A specialized gauge that tracks a time value, to be scaled to the base unit of time
expected by each registry implementation.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Fluent builder for time gauges.Nested classes/interfaces inherited from interface io.micrometer.core.instrument.Meter
Meter.Id, Meter.Type
-
Method Summary
Modifier and TypeMethodDescriptionstatic TimeGauge.Builder<Supplier<Number>>
A convenience method for building a time gauge from a supplying function, holding a strong reference to this function.static <T> TimeGauge.Builder<T>
builder
(String name, T obj, TimeUnit fUnits, ToDoubleFunction<T> f) default double
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
static <T> TimeGauge.Builder<T> builder(String name, @Nullable T obj, TimeUnit fUnits, ToDoubleFunction<T> f) -
builder
@Incubating(since="1.7.0") static TimeGauge.Builder<Supplier<Number>> builder(String name, Supplier<Number> f, TimeUnit fUnits) A convenience method for building a time gauge from a supplying function, holding a strong reference to this function.- Parameters:
name
- The time gauge's name.f
- A function that yields a double value for the time gauge.fUnits
- time unit- Returns:
- A new time gauge builder.
- Since:
- 1.7.0
-
baseTimeUnit
TimeUnit baseTimeUnit()- Returns:
- The base time unit of the timer to which all published metrics will be scaled
-
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.- Parameters:
unit
- The base unit of time to scale the value to.- Returns:
- The current value, scaled to the appropriate base unit.
-