Summary class
Similar to a Histogram, a Summary samples observations (usually things like request durations and response sizes). While it also provides a total count of observations and a sum of all observed values, it calculates configurable quantiles over a sliding time window.
Constructors
-
Summary({required String name, required String help, List<
String> labelNames = const [], List<Quantile> quantiles = const [], Duration maxAge = const Duration(minutes: 10), int ageBuckets = 5, Collect<Summary> ? collectCallback}) -
Construct a new Summary with a
name,helptext, optionallabelNames, optionalquantiles, optionalmaxAgeand optionalageBuckets. IflabelNamesare provided, use labels(...) to assign label values. If noquantilesare provided the summary only has a count and sum. If not provided,maxAgedefaults to 10 minutes andageBucketsto 5. The optionalcollectCallbackis called at the beginning of collect and allows to update the value of the summary before collecting it.
Properties
- ageBuckets → int
-
Set the number of buckets used to implement the sliding time window. If
your time window is 10 minutes, and you have ageBuckets=5, buckets will
be switched every 2 minutes. The value is a trade-off between resources
(memory and cpu for maintaining the bucket) and how smooth the time window
is moved.
final
-
collectCallback
→ Collect<
Summary> ? -
Optional callback called in collect before samples are collected.
final
- count → double
-
Access the count of elements in a summary without labels.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- help → String
-
The
helptext of the metric.finalinherited -
labelNames
→ List<
String> -
The unmodifiable list of
labelNamesassigned to this metric.finalinherited - maxAge → Duration
-
Set the duration of the time window is, i.e. how long observations are
kept before they are discarded.
final
- name → String
-
The
nameof the metric.finalinherited -
quantiles
→ List<
Quantile> -
Quantiles to observe by the summary.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sum → double
-
Access the total sum of the elements in a summary without labels.
no setter
- values → Map
-
Access the value of each quantile of a summary without labels.
no setter
Methods
-
clear(
) → void -
Remove all
Childmetrics.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) → SummaryChild -
Create a
Childmetric and assign thelabelValues. The size of thelabelValueshas to match thelabelNamesof 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
vand store it in the summary without labels. -
observeDuration<
T> (Future< T> f) → Future<T> -
Observe the duration of the Future
fand store it in the summary without labels. -
observeDurationSync<
T> (T callback()) → T -
Observe the duration of
callbackand store it in the summary without labels. -
register(
[CollectorRegistry? registry]) → void -
Register the Collector at a
registry. If noregistryis provided, the CollectorRegistry.defaultRegistry is used.inherited -
remove(
List< String> labelValues) → void -
Remove a
Childmetric 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
- quantileLabel → const String