Gauge class
A Gauge represents a value that can go up and down.
Constructors
-
Gauge.new({required String name, required String help, List<
String> labelNames = const [], Collect<Gauge> ? collectCallback}) -
Construct a new Gauge with a
name
,help
text and optionallabelNames
. IflabelNames
are provided, use labels(...) to assign label values. The optionalcollectCallback
is called at the beginning of collect and allows to update the value of the gauge before collecting it.
Properties
-
collectCallback
→ Collect<
Gauge> ? -
Optional callback called in collect before samples are collected.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- help → String
-
The
help
text of the metric.finalinherited -
labelNames
→ List<
String> -
The unmodifiable list of
labelNames
assigned to this metric.finalinherited - name → String
-
The
name
of the metric.finalinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value ↔ double
-
Accesses the current value of the gauge without labels.
getter/setter pair
Methods
-
clear(
) → void -
Remove all
Child
metrics.inherited -
collect(
) → Future< Iterable< MetricFamilySamples> > -
collect all metrics and samples that are part of this Collector.
override
-
collectNames(
) → Iterable< String> -
Collect all metric names, including child metrics.
override
-
dec(
[double amount = 1]) → void -
Decrement the value of the gauge without labels by
amount
. Decrements by one, if no amount is provided. -
inc(
[double amount = 1]) → void -
Increment the value of the gauge without labels by
amount
. Increments by one, if no amount is provided. -
labels(
List< String> labelValues) → GaugeChild -
Create a
Child
metric and assign thelabelValues
. The size of thelabelValues
has to match thelabelNames
of the metric.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
register(
[CollectorRegistry? registry]) → void -
Register the Collector at a
registry
. If noregistry
is provided, the CollectorRegistry.defaultRegistry is used.inherited -
remove(
List< String> labelValues) → void -
Remove a
Child
metric based on it's label values.inherited -
setToCurrentTime(
) → void - Set the value of the gauge without labels to the current time as a unix timestamp.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited