Swiftpack.co - Package - apple/swift-statsd-client

SwiftStatsDClient

a metrics backend for swift-metrics that uses the statsd protocol, and can be used to integrate applications with observability solutions that support statsd including:

getting started

create an instance of the StatsdClient and boostrap the MertricsSystem in your application's main:

let statsdClient = try StatsdClient(host: host, port: port)
MetricsSystem.bootstrap(statsdClient)

see https://github.com/apple/swift-metrics#selecting-a-metrics-backend-implementation-applications-only

remeber to also shutdown the client before you application terminates:

statsdClient.shutdown()

architecture

the statsd client uses swift-nio to establish a UDP connection to the statsd server

metrics types are mapped as follwoing:

  • Counter -> Counter
  • Gauge -> Gauge
  • Recorder -> Histogram
  • Timer -> Timer

Github

link
Stars: 32

Used By

Total: 0

Releases

1.0.0-alpha.4 - 2020-06-11 02:14:00

Introduces MetricNameSanitizer and enables it by default, allowing statsd-client to be used directly with Vapor apps (as their metric labels may include : which was causing trouble).

See #21 for details.

1.0.0-alpha.3 - 2020-03-09 06:52:32

3rd alpha release, fixes important issue with connection leak #14

1.0.0-alpha.2 - 2019-12-19 21:43:24

second alpha release

1.0.0-alpha.1 - 2019-09-19 01:52:58

first alpha release