Counter<T extends num> class

A synchronous instrument that records monotonically increasing values.

A Counter is used to measure a non-negative, monotonically increasing value. Counters only allow positive increments and are appropriate for values that never decrease, such as:

  • Request count
  • Completed operations
  • Error count
  • CPU time used
  • Bytes sent/received

If the value can decrease, use an UpDownCounter instead.

More information: https://opentelemetry.io/docs/specs/otel/metrics/api/#counter

Implemented types

Constructors

Counter({required APICounter<T> apiCounter, required Meter meter})
Creates a new Counter instance.

Properties

advisory → InstrumentAdvisory?
Returns the advisory parameters of this Counter.
no setteroverride
description → String?
Gets the description of this counter.
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
isCounter → bool
Always true for Counter instruments.
no setteroverride
isGauge → bool
Always false for Counter instruments.
no setteroverride
isHistogram → bool
Always false for Counter instruments.
no setteroverride
isUpDownCounter → bool
Always false for Counter instruments.
no setteroverride
meter → APIMeter
Gets the meter that created this counter.
no setteroverride
name → String
Gets the name of this counter.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
unit → String?
Gets the unit of measurement for this counter.
no setteroverride

Methods

add(T value, [Attributes? attributes]) → void
Records a measurement with this counter.
override
addWithMap(T value, Map<String, Object> attributeMap) → void
Records a measurement with attributes specified as a map.
override
collectMetrics() → List<Metric>
Collects metrics for this counter.
override
collectPoints() → List<MetricPoint<T>>
Gets the current points for this counter.
getValue([Attributes? attributes]) → T
Gets the current value of the counter for a specific set of attributes.
isEnabled() → bool
Checks if this counter is enabled.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Resets the counter.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited