factory
Returns a reference to the configured factory.
static var factory: MetricsFactory { get }
Returns a reference to the configured factory.
static var factory: MetricsFactory { get }
import CoreMetrics
A Metrics API package for Swift.
enum MetricsSystem
The MetricsSystem
is a global facility where the default metrics backend implementation (MetricsFactory
) can be configured. MetricsSystem
is set up just once in a given program to set up the desired metrics backend implementation.
protocol MetricsFactory : _SwiftMetricsSendableProtocol
The MetricsFactory
is the bridge between the MetricsSystem
and the metrics backend implementation. MetricsFactory
’s role is to initialize concrete implementations of the various metric types:
static func bootstrap(_ factory: MetricsFactory)
bootstrap
is an one-time configuration function which globally selects the desired metrics backend implementation. bootstrap
can be called at maximum once in any given program, calling it more than once will lead to undefined behavior, most likely a crash.
static func withWriterLock<T>(_ body: () throws -> T) rethrows -> T
Acquire a writer lock for the duration of the given block.