DogStatsD backend for SwiftMetrics, built on top of StatsdUDPTransport from swift-statsd-client.
import DogStatsdClient
import Metrics
let dogStatsdClient = try DogStatsdClient(host: "127.0.0.1", port: 8125)
MetricsSystem.bootstrap(dogStatsdClient)
let counter = Counter(label: "requests", dimensions: [("service", "api")])
counter.increment()Dimensions are mapped to DogStatsD tags, while the label becomes the metric name. After bootstrap, your code only needs to interact with the SwiftMetrics API.
let dogStatsdClient = try DogStatsdClient(
host: "127.0.0.1",
port: 8125,
defaultTags: [("env", "prod"), ("service", "api")],
containerID: "container-123"
)The client also exposes a direct emit API for DogStatsD-specific features such as sample rates
and timestamps when needed.
See Examples/Basic/main.swift for a minimal end-to-end setup.