increment(by:)
Increment the counter.
func increment<DataType>(by amount: DataType) where DataType : BinaryInteger
Parameters
- amount
Amount to increment by.
Increment the counter.
func increment<DataType>(by amount: DataType) where DataType : BinaryInteger
Amount to increment by.
import CoreMetrics
A Metrics API package for Swift.
final class Counter
A counter is a cumulative metric that represents a single monotonically increasing counter whose value can only increase or be reset to zero. For example, you can use a counter to represent the number of requests served, tasks completed, or errors.
protocol BinaryInteger : CustomStringConvertible, Hashable, Numeric, Strideable where Self.Magnitude : BinaryInteger, Self.Magnitude == Self.Magnitude.Magnitude
An integer type with a binary representation.
convenience init(label: String, dimensions: [(String, String)] = [])
Create a new Counter
.
init(label: String, dimensions: [(String, String)], handler: CounterHandler)
Alternative way to create a new Counter
, while providing an explicit CounterHandler
.
let _handler: CounterHandler
_handler
is only public to allow access from MetricsTestKit
. Do not consider it part of the public API.
var description: String { get }
let dimensions: [(String, String)]
let label: String
func destroy()
Signal the underlying metrics library that this counter will never be updated again. In response the library MAY decide to eagerly release any resources held by this Counter
.
func increment()
Increment the counter by one.
func reset()
Reset the counter back to zero.