Package io.micrometer.core.instrument
Class Metrics.More
java.lang.Object
io.micrometer.core.instrument.Metrics.More
- Enclosing class:
Metrics
Additional, less commonly used meter types.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T extends Number>
FunctionCounterTracks a number, maintaining a weak reference on it.<T> FunctionCounter
counter
(String name, Iterable<Tag> tags, T obj, ToDoubleFunction<T> countFunction) Tracks a monotonically increasing value, automatically incrementing the counter whenever the value is observed.longTaskTimer
(String name, Iterable<Tag> tags) Measures the time taken for long tasks.longTaskTimer
(String name, String... tags) Measures the time taken for long tasks.<T> TimeGauge
timeGauge
(String name, Iterable<Tag> tags, T obj, TimeUnit timeFunctionUnit, ToDoubleFunction<T> timeFunction) A gauge that tracks a time value, to be scaled to the monitoring system's base time unit.<T> FunctionTimer
timer
(String name, Iterable<Tag> tags, T obj, ToLongFunction<T> countFunction, ToDoubleFunction<T> totalTimeFunction, TimeUnit totalTimeFunctionUnit) A timer that tracks monotonically increasing functions for count and totalTime.
-
Constructor Details
-
More
public More()
-
-
Method Details
-
longTaskTimer
Measures the time taken for long tasks.- Parameters:
name
- Name of the gauge being registered.tags
- MUST be an even number of arguments representing key/value pairs of tags.- Returns:
- A new or existing long task timer.
-
longTaskTimer
Measures the time taken for long tasks.- Parameters:
name
- Name of the gauge being registered.tags
- Sequence of dimensions for breaking down the name.- Returns:
- A new or existing long task timer.
-
counter
public <T> FunctionCounter counter(String name, Iterable<Tag> tags, T obj, ToDoubleFunction<T> countFunction) Tracks a monotonically increasing value, automatically incrementing the counter whenever the value is observed.- Type Parameters:
T
- The type of the state object from which the counter value is extracted.- Parameters:
name
- Name of the gauge being registered.tags
- Sequence of dimensions for breaking down the name.obj
- State object used to compute a value.countFunction
- Function that produces a monotonically increasing counter value from the state object.- Returns:
- A new or existing function counter.
-
counter
Tracks a number, maintaining a weak reference on it.- Type Parameters:
T
- The type of the state object from which the counter value is extracted.- Parameters:
name
- Name of the gauge being registered.tags
- Sequence of dimensions for breaking down the name.number
- A monotonically increasing number to track.- Returns:
- A new or existing function counter.
-
timeGauge
public <T> TimeGauge timeGauge(String name, Iterable<Tag> tags, T obj, TimeUnit timeFunctionUnit, ToDoubleFunction<T> timeFunction) A gauge that tracks a time value, to be scaled to the monitoring system's base time unit.- Type Parameters:
T
- The type of the state object from which the gauge value is extracted.- Parameters:
name
- Name of the gauge being registered.tags
- Sequence of dimensions for breaking down the name.obj
- State object used to compute a value.timeFunctionUnit
- The base unit of time produced by the total time function.timeFunction
- Function that produces a time value from the state object. This value may increase and decrease over time.- Returns:
- A new or existing time gauge.
-
timer
public <T> FunctionTimer timer(String name, Iterable<Tag> tags, T obj, ToLongFunction<T> countFunction, ToDoubleFunction<T> totalTimeFunction, TimeUnit totalTimeFunctionUnit) A timer that tracks monotonically increasing functions for count and totalTime.- Type Parameters:
T
- The type of the state object from which the function values are extracted.- Parameters:
name
- Name of the gauge being registered.tags
- Sequence of dimensions for breaking down the name.obj
- State object used to compute a value.countFunction
- Function that produces a monotonically increasing counter value from the state object.totalTimeFunction
- Function that produces a monotonically increasing total time value from the state object.totalTimeFunctionUnit
- The base unit of time produced by the total time function.- Returns:
- A new or existing function timer.
-