Histogram constructor
Histogram({})
Construct a new Histogram with a name
, help
text, optional
labelNames
and optional upper bounds for the buckets
.
If labelNames
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.
Implementation
Histogram({
required String name,
required String help,
List<String> labelNames = const [],
List<double> buckets = defaultBuckets,
this.collectCallback,
}) : buckets = List.unmodifiable(_sanitizeBuckets(buckets)),
super(name: name, help: help, labelNames: labelNames) {
if (labelNames.contains(leLabel)) {
throw ArgumentError.value(labelNames, 'labelNames',
'"le" is a reserved label name for a histogram.');
}
}