Counter instrument that records values of type A.
The Counter is monotonic, meaning the aggregated value is nominally increasing.
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 a Counter
Counters are created using theMeter API:
Backend Methods
add
Records a value with a set of attributes.The value to increment the counter with. Must be non-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:
Builder Methods
withUnit
Sets the unit of measure for this counter.The measurement unit. Must be 63 or fewer ASCII characters.
Counter.Builder[F, A]
Reference: Instrument Unit
withDescription
Sets the description for this counter.The description of the counter.
Counter.Builder[F, A]
Reference: Instrument Description
create
Creates aCounter with the configured unit and description.
Returns: F[Counter[F, A]]
See Also
- UpDownCounter - for non-monotonic counters