Histogram class
Histogram allows aggregatable distributions of events, such as request latencies.
Constructors
-
Histogram({required String name, required String help, List<
String> labelNames = const [], List<double> buckets = defaultBuckets, Collect<Histogram> ? collectCallback}) -
Construct a new Histogram with a
name
,help
text, optionallabelNames
and optional upper bounds for thebuckets
. IflabelNames
are provided, use labels(...) to assign label values.buckets
have to be sorted in ascending order. If no buckets are provided the defaultBuckets are used instead. The optional collectCallback is called at the beginning of collect and allows to update the value of the histogram before collecting it. -
Histogram.exponential({required String name, required String help, required double start, required double factor, required int count, List<
String> labelNames = const [], Collect<Collector> ? collectCallback}) -
Construct a new Histogram with a
name
,help
text, and optionallabelNames
. Thecount
buckets are exponential distributed starting atstart
with a distance growing exponentially byfactor
. 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 histogram before collecting it. -
Histogram.linear({required String name, required String help, required double start, required double width, required int count, List<
String> labelNames = const [], Collect<Collector> ? collectCallback}) -
Construct a new Histogram with a
name
,help
text, and optionallabelNames
. Thecount
buckets are linear distributed starting atstart
with a distance ofwidth
. 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 histogram before collecting it.
Properties
-
buckets
→ List<
double> -
The upper bounds of the buckets.
final
-
bucketValues
→ List<
double> -
Access the values in the buckets of a histogram without labels.
no setter
-
collectCallback
→ Collect<
Histogram> ? -
Optional callback called in collect before samples are collected.
final
- count → double
-
Access the count of elements in a histogram without labels.
no setter
- 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
- sum → double
-
Access the total sum of the elements in a histogram without labels.
no setter
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
-
labels(
List< String> labelValues) → HistogramChild -
Create a
Child
metric and assign thelabelValues
. The size of thelabelValues
has to match the labelNames of the metric.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
observe(
double v) → void -
Observe a new value
v
and store it in the corresponding buckets of a histogram without labels. -
observeDuration<
T> (Future< T> f) → Future<T> -
Observe the duration of the Future
f
and store it in the corresponding buckets of a histogram without labels. -
observeDurationSync<
T> (T callback()) → T -
Observe the duration of
callback
and store it in the corresponding buckets of a histogram without labels. -
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 -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
defaultBuckets
→ const List<
double> - The default upper bounds for histogram buckets.
- leLabel → const String
- Name of the 'le' label.