modulepackage
0.3.2
Repository: https://github.com/intuitivelabs/counters.git
Documentation: pkg.go.dev
# README
counters
Package counters provides easy to use atomic counters. The counters are defined in groups and each groups can have subgroups resulting in a tree like structure.
Each counter has an associated handle (used in all the operations), name and description.
Supported operations are increment, decrement, min and max.
Entire groups (complete with their subgroups subtree) can be printed.
# Functions
CopyGrp will copy all the counters from the src Group to dst.
FillRate will fill/overwrite the counters in the dst group with the difference of the counters from a & b divided by the provided number of units (dst = (a-b)/units).
NewGroup creates a new counter group, with a specified name and parent.
ResetGrp will set all the counters to v.
# Constants
The whole counter should be hidden.
The counter value should be hidden (not printed).
Hide value if 0.
Counter is storing Max values.
Counter is storing Min values.
The counter is not monotonic, no rate should be computed.
Invalid marks an invalid handle (e.g.
Print counter description (cnt: [val] [desc]).
Full counter name, e.g.: group1.group2.counter.
Print only non zero values.
Print recursively all subgroups.
Print value (cnt: val).
# Variables
RootGrp contains all the groups defined without a parent group (nil).