makeMeter(label:dimensions:)
StatsdClient.swift:72func makeMeter(label: String, dimensions: [(String, String)]) -> MeterHandler
func makeMeter(label: String, dimensions: [(String, String)]) -> MeterHandler
s12StatsdClientAAC9makeMeter5label10dimensions11CoreMetrics0D7Handler_pSS_SaySS_SStGtF
What are these?8UHAN
import StatsdClient
A metrics backend implementation using the StatsD protocol.
final class StatsdClient
StatsdClient
is a metrics backend for SwiftMetrics
, designed to integrate applications with observability servers that support statsd
protocol. The client uses SwiftNIO
to establish a UDP connection to the statsd
server.
@frozen struct String
A Unicode string value that is a collection of characters.
protocol MeterHandler : AnyObject, _SwiftMetricsSendableProtocol
A MeterHandler
represents a backend implementation of a Meter
.
init(eventLoopGroupProvider: EventLoopGroupProvider = .createNew, host: String, port: Int, metricNameSanitizer: @escaping StatsdClient.MetricNameSanitizer = StatsdClient.defaultMetricNameSanitizer) throws
Create a new instance of StatsdClient
.
static let defaultMetricNameSanitizer: StatsdClient.MetricNameSanitizer
Default implementation of LabelSanitizer
that sanitizes any “:” occurrences by replacing them with a replacement character. Defaults to replacing the illegal characters with “_”, e.g. “offending:example” becomes “offending_example”.
func destroyCounter(_ handler: CounterHandler)
func destroyMeter(_ handler: MeterHandler)
func destroyRecorder(_ handler: RecorderHandler)
func destroyTimer(_ handler: TimerHandler)
func makeCounter(label: String, dimensions: [(String, String)]) -> CounterHandler
func makeRecorder(label: String, dimensions: [(String, String)], aggregate: Bool) -> RecorderHandler
func makeTimer(label: String, dimensions: [(String, String)]) -> TimerHandler
@preconcurrency func shutdown(_ callback: @escaping (Error?) -> Void)
Shutdown the client. This is a noop when using the shared(_:)
strategy.
enum EventLoopGroupProvider
A EventLoopGroupProvider
defines how the underlying EventLoopGroup
used to create the EventLoop
is provided.
typealias MetricNameSanitizer = (String) -> String
Used to sanitize labels (and dimensions) into a format compatible with statsd’s wire format.