CounterHandler
public protocol CounterHandler : AnyObject
A CounterHandler
represents a backend implementation of a Counter
.
This type is an implementation detail and should not be used directly, unless implementing your own metrics backend.
To use the SwiftMetrics API, please refer to the documentation of Counter
.
Implementation requirements
To implement your own CounterHandler
you should respect a few requirements that are necessary so applications work
as expected regardless of the selected CounterHandler
implementation.
- The
CounterHandler
must be aclass
.
-
Increment the counter.
Declaration
Swift
func increment(by: Int64)
Parameters
by
Amount to increment by.
-
Reset the counter back to zero.
Declaration
Swift
func reset()