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
,help
text, optionallabelNames
, optionalquantiles
, optionalmaxAge
and optionalageBuckets
. IflabelNames
are provided, use labels(...) to assign label values. If noquantiles
are provided the summary only has a count and sum. If not provided,maxAge
defaults to 10 minutes andageBuckets
to 5. The optionalcollectCallback
is 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
help
text of the metric.finalinherited -
labelNames
→ List<
String> -
The unmodifiable list of
labelNames
assigned 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
name
of 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
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) → SummaryChild -
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
-
observe(
double v) → void -
Observe a new value
v
and store it in the summary without labels. -
observeDuration<
T> (Future< T> f) → Future<T> -
Observe the duration of the Future
f
and store it in the summary without labels. -
observeDurationSync<
T> (T callback()) → T -
Observe the duration of
callback
and store it in the summary 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
- quantileLabel → const String