public interface Gauge extends Meter
Modifier and Type | Interface and Description |
---|---|
static class |
Gauge.Builder<T>
Fluent builder for gauges.
|
Meter.Id, Meter.Type
Modifier and Type | Method and Description |
---|---|
static <T> Gauge.Builder<T> |
builder(String name,
T obj,
ToDoubleFunction<T> f)
Setup a
Gauge.Builder that will create a gauge that reports the value returned by the provided function. |
static <T extends Number> |
constantGauge(String name,
T number)
Setup a
Gauge.Builder that will create a gauge that reports the value of the Number . |
static <T> Gauge.Builder<T> |
doubleGauge(String name,
DoubleSupplier valueFunction)
Setup a
Gauge.Builder that will create a gauge that reports the size of the Map . |
static <T extends Collection<?>> |
gaugeCollectionSize(String name,
T collection)
Setup a
Gauge.Builder that will create a gauge that reports the size of the Collection . |
static <T extends Map<?,?>> |
gaugeMapSize(String name,
T map)
Setup a
Gauge.Builder that will create a gauge that reports the size of the Map . |
default Iterable<Measurement> |
measure()
Get a set of measurements.
|
double |
value()
Returns the current value.
|
static <T> Gauge.Builder<T> builder(String name, @Nullable T obj, ToDoubleFunction<T> f)
Gauge.Builder
that will create a gauge that reports the value returned by the provided function.T
- The type of the object to monitorname
- Name of the gauge being registered.obj
- The object to monitorf
- The function to apply to the object to monitorGauge
.@Nullable static <T> Gauge.Builder<T> doubleGauge(String name, DoubleSupplier valueFunction)
Gauge.Builder
that will create a gauge that reports the size of the Map
.
The collection implementation used should be thread safe. Note that calling
Map.size()
can be expensive for some collection implementations
and should be considered before registering.T
- The type of the state object from which the gauge value is extracted.name
- Name of the gauge being registered.valueFunction
- a function which returns a doubleGauge
.static <T extends Number> Gauge.Builder<T> constantGauge(String name, T number)
Gauge.Builder
that will create a gauge that reports the value of the Number
.@Nullable static <T extends Collection<?>> Gauge.Builder<T> gaugeCollectionSize(String name, T collection)
Gauge.Builder
that will create a gauge that reports the size of the Collection
.
The collection implementation used should be thread safe. Note that calling
Collection.size()
can be expensive for some collection implementations
and should be considered before registering.T
- The type of the state object from which the gauge value is extracted.name
- Name of the gauge being registered.collection
- Thread-safe implementation of Collection
used to access the value.Gauge
.@Nullable static <T extends Map<?,?>> Gauge.Builder gaugeMapSize(String name, T map)
Gauge.Builder
that will create a gauge that reports the size of the Map
.
The collection implementation used should be thread safe. Note that calling
Map.size()
can be expensive for some collection implementations
and should be considered before registering.double value()
default Iterable<Measurement> measure()
Meter
Copyright 2010-2022 ForgeRock AS.