Counter instrument that records values of type A.
The UpDownCounter is non-monotonic, meaning the aggregated value can both increase and decrease.
Type Signature
F[_]- the higher-kinded type of a polymorphic effectA- the type of values to record. Must have aMeasurementValueinstance.LongandDoubleare supported out of the box.
Creating an UpDownCounter
UpDownCounters are created using theMeter API:
Backend Methods
add
Records a value with a set of attributes.The value to add to the counter. Can be positive or negative.
The set of attributes to associate with the value.
F[Unit]
Example:
inc
Increments the counter by one.The set of attributes to associate with the value.
F[Unit]
Example:
dec
Decrements the counter by one.The set of attributes to associate with the value.
F[Unit]
Example:
Builder Methods
withUnit
Sets the unit of measure for this counter.The measurement unit. Must be 63 or fewer ASCII characters.
UpDownCounter.Builder[F, A]
Reference: Instrument Unit
withDescription
Sets the description for this counter.The description of the counter.
UpDownCounter.Builder[F, A]
Reference: Instrument Description
create
Creates anUpDownCounter with the configured unit and description.
Returns: F[UpDownCounter[F, A]]
See Also
- Counter - for monotonic counters