# Statsd client in swift

**URL:** <https://forums.swift.org/t/statsd-client-in-swift/25134>\
**Category:** Pitches\
**Created:** [June 2, 2019, 9:27pm UTC](https://forums.swift.org/t/statsd-client-in-swift/25134 "2019-06-02T21:27:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomerd](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tomerd/32/3402_2.png) [@tomerd](https://forums.swift.org/u/tomerd)\
**Post date:** [June 2, 2019, 9:27pm UTC](https://forums.swift.org/t/statsd-client-in-swift/25134/1 "2019-06-02T21:27:27Z")

</div>

**background**

following the release of [swift-metrics](https://github.com/apple/swift-metrics), this pitch is for a compatible library that uses the [statsd](https://github.com/b/statsd_spec) protocol, and can be used to integrate applications with observability solutions that support `statsd` such as:

- [aws](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-custom-metrics-statsd.html)
- [azure](https://docs.microsoft.com/en-us/azure/azure-monitor/platform/data-platform)
- [google cloud](https://cloud.google.com/monitoring/agent/plugins/statsd)
- [ibm cloud](https://cloud.ibm.com/catalog/services/ibm-cloud-monitoring-with-sysdig)
- [grafana](https://grafana.com)
- [graphite](https://graphiteapp.org)

**architecture**

a `statsd` client that uses [swift-nio](https://github.com/apple/swift-nio) to establish a UDP connection to the statsd server

metrics types are mapped as following:

- Counter -\> Counter
- Gauge -\> Gauge
- Recorder -\> Histogram
- Timer -\> Timer

code: [GitHub - tomerd/swift-statsd-client: metrics backend for swift-metrics that uses the statsd protocol](https://github.com/tomerd/swift-statsd-client)

---

<div class="post-metadata">

**Author:** ![IanPartridge](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ianpartridge/32/434_2.png) [@IanPartridge](https://forums.swift.org/u/IanPartridge)\
**Post date:** [June 3, 2019, 1:29pm UTC](https://forums.swift.org/t/statsd-client-in-swift/25134/2 "2019-06-03T13:29:53Z")

</div>

+1 definitely on-topic for SSWG. Great to see the metrics API proving itself, and showing it's possible to build a statsd client in just a few hundreds lines of code.

Can probably default the `port` to `8125`.

---

<div class="post-metadata">

**Author:** ![johannesweiss](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/johannesweiss/32/38183_2.png) [@johannesweiss](https://forums.swift.org/u/johannesweiss)\
**Post date:** [June 3, 2019, 4:43pm UTC](https://forums.swift.org/t/statsd-client-in-swift/25134/3 "2019-06-03T16:43:25Z")

</div>

awesome! +1

---

<div class="post-metadata">

**Author:** ![spprichard](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/spprichard/32/22828_2.png) [@spprichard](https://forums.swift.org/u/spprichard)\
**Post date:** [June 4, 2019, 11:03pm UTC](https://forums.swift.org/t/statsd-client-in-swift/25134/4 "2019-06-04T23:03:05Z")

</div>

love it! +1

---

<div class="post-metadata">

**Author:** ![ktoso](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ktoso/32/44526_2.png) [@ktoso](https://forums.swift.org/u/ktoso)\
**Post date:** [June 5, 2019, 5:50am UTC](https://forums.swift.org/t/statsd-client-in-swift/25134/5 "2019-06-05T05:50:41Z")

</div>

+1, looking great :-) awesome to have statsd support :-)
