reset
Reset the FloatingPointCounter back to zero.
func reset()
Reset the FloatingPointCounter back to zero.
func reset()
import CoreMetrics
A Metrics API package for Swift.
final class FloatingPointCounter
A FloatingPointCounter is a cumulative metric that represents a single monotonically increasing FloatingPointCounter whose value can only increase or be reset to zero. For example, you can use a FloatingPointCounter to represent the number of requests served, tasks completed, or errors. FloatingPointCounter is not supported by all metrics backends, however a default implementation is provided which accumulates floating point values and records increments to a standard Counter after crossing integer boundaries.
convenience init(label: String, dimensions: [(String, String)] = [])
Create a new FloatingPointCounter
.
init(label: String, dimensions: [(String, String)], handler: FloatingPointCounterHandler)
Alternative way to create a new FloatingPointCounter
, while providing an explicit FloatingPointCounterHandler
.
let _handler: FloatingPointCounterHandler
_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 FloatingPointCounter will never be updated again. In response the library MAY decide to eagerly release any resources held by this FloatingPointCounter
.
func increment()
Increment the FloatingPointCounter by one.
func increment<DataType>(by amount: DataType) where DataType : BinaryFloatingPoint
Increment the FloatingPointCounter.