Summary constructor

Summary({
  1. required String name,
  2. required String help,
  3. List<String> labelNames = const [],
  4. List<Quantile> quantiles = const [],
  5. Duration maxAge = const Duration(minutes: 10),
  6. int ageBuckets = 5,
  7. Collect<Summary>? collectCallback,
})

Construct a new Summary with a name, help text, optional labelNames, optional quantiles, optional maxAge and optional ageBuckets. If labelNames are provided, use labels(...) to assign label values. If no quantiles are provided the summary only has a count and sum. If not provided, maxAge defaults to 10 minutes and ageBuckets to 5. The optional collectCallback is called at the beginning of collect and allows to update the value of the summary before collecting it.

Implementation

Summary({
  required String name,
  required String help,
  List<String> labelNames = const [],
  List<Quantile> quantiles = const [],
  this.maxAge = const Duration(minutes: 10),
  this.ageBuckets = 5,
  this.collectCallback,
})  : quantiles = List.unmodifiable(quantiles),
      super(name: name, help: help, labelNames: labelNames) {
  if (labelNames.contains(quantileLabel)) {
    throw ArgumentError.value(labelNames, 'labelNames',
        '"quantile" is a reserved label name for a summary.');
  }
}