MetricsSystem

public 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.

  • Acquire a writer lock for the duration of the given block.

    Declaration

    Swift

    public static func withWriterLock<T>(_ body: () throws -> T) rethrows -> T

    Parameters

    body

    The block to execute while holding the lock.

    Return Value

    The value returned by the block.

  • 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 behaviour, most likely a crash.

    Declaration

    Swift

    public static func bootstrap(_ factory: MetricsFactory)

    Parameters

    factory

    A factory that given an identifier produces instances of metrics handlers such as CounterHandler, RecorderHandler and TimerHandler.

  • Returns a reference to the configured factory.

    Declaration

    Swift

    public static var factory: MetricsFactory { get }