Interface Gauge<N extends Number>
- Type Parameters:
N- subtype ofNumberwhich a specific gauge reports
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceGauge.Builder<N extends Number>Builder for a new gauge.Nested classes/interfaces inherited from interface Meter
Meter.BaseUnits, Meter.Id, Meter.Scope, Meter.TypeModifier and TypeInterfaceDescriptionstatic classCommon unit declarations (inspired by the list from MicroProfile metrics).static interfaceUnique idenfier for a meter.static classDeprecated, for removal: This API element is subject to removal in a future version.Core metrics ignores scope values, and this type will be removed.static enumType of meter. -
Method Summary
Modifier and TypeMethodDescriptionstatic <N extends Number>
Gauge.Builder<N> Deprecated, for removal: This API element is subject to removal in a future version.this method uses service registry to get aMetricsFactoryinstance, which may be inefficient, useMetricsFactory.gaugeBuilder(String, java.util.function.Supplier)insteadstatic <T> Gauge.Builder<Double> builder(String name, T stateObject, ToDoubleFunction<T> fn) Deprecated, for removal: This API element is subject to removal in a future version.this method uses service registry to get aMetricsFactoryinstance, which may be inefficient, useMetricsFactory.gaugeBuilder(String, Object, java.util.function.ToDoubleFunction)insteadvalue()Returns the value of the gauge.Methods inherited from interface Meter
baseUnit, description, id, scope, typeModifier and TypeMethodDescriptionbaseUnit()Returns the meter's base unit.Returns the meter's description.id()Returns the meter ID.scope()Deprecated, for removal: This API element is subject to removal in a future version.Core metrics does not assign scopes, and this method will be removed.type()Returns the meter type.
-
Method Details
-
builder
@Deprecated(forRemoval=true, since="27.0.0") static <T> Gauge.Builder<Double> builder(String name, T stateObject, ToDoubleFunction<T> fn) Deprecated, for removal: This API element is subject to removal in a future version.this method uses service registry to get aMetricsFactoryinstance, which may be inefficient, useMetricsFactory.gaugeBuilder(String, Object, java.util.function.ToDoubleFunction)insteadCreates a builder for creating a new gauge based on applying a function to a state object.- Type Parameters:
T- type of the state object- Parameters:
name- gauge namestateObject- state object which maintains the gauge valuefn- function which, when applied to the state object, returns the gauge value- Returns:
- new builder
-
builder
@Deprecated(forRemoval=true, since="27.0.0") static <N extends Number> Gauge.Builder<N> builder(String name, Supplier<N> numberSupplier) Deprecated, for removal: This API element is subject to removal in a future version.this method uses service registry to get aMetricsFactoryinstance, which may be inefficient, useMetricsFactory.gaugeBuilder(String, java.util.function.Supplier)insteadCreates a builder for a supplier-based gauge. -
value
N value()Returns the value of the gauge.Invoking this method triggers the sampling of the value or invocation of the function provided when the gauge was registered.
- Returns:
- current value of the gauge
-