APIObservableUpDownCounter<T extends num> class

APIObservableUpDownCounter is an asynchronous Instrument which reports values that increase or decrease when the instrument is being observed.

An ObservableUpDownCounter is intended for capturing values that can increase or decrease, such as the current memory usage, active requests, or items in a queue.

All methods of this class are safe for concurrent use by default: implementations must remain correct when methods are invoked from interleaved asynchronous tasks within an isolate. See Metrics API, concurrency requirements.

Implemented types

Constructors

APIObservableUpDownCounter(String _name, String? _description, String? _unit, APIMeter _meter, [InstrumentAdvisory? _advisory, List<ObservableCallback<T>> callbacks = const []])
Creates a new observable up-down counter instrument

Properties

advisory → InstrumentAdvisory?
Returns the advisory parameters of this observable up-down counter.
no setter
callbacks → List<ObservableCallback<T>>
Returns the current list of callbacks registered to this instrument.
no setter
description → String?
Returns the description of this observable up-down counter.
no setter
hashCode → int
The hash code for this object.
no setterinherited
meter → APIMeter
Returns the meter that created this observable up-down counter.
no setteroverride
name → String
Returns the name of this observable up-down counter.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
unit → String?
Returns the unit of this observable up-down counter.
no setter

Methods

addCallback(ObservableCallback<T> callback) → APICallbackRegistration<T>
Registers a callback function that will be invoked when the instrument is observed. Returns a registration handle that can be used to unregister the callback.
collect() → List<Measurement<num>>
Collects measurements from all registered callbacks. This method is typically only called by the SDK during collection.
isEnabled() → bool
Returns whether the instrument is enabled and will record measurements.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeCallback(ObservableCallback<T> callback) → void
Removes a callback from this instrument by direct reference.
toString() → String
A string representation of this object.
inherited

Operators

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