{"id":21992374,"url":"https://github.com/khoi-backyard/swift-statsd-client","last_synced_at":"2026-02-27T20:13:59.173Z","repository":{"id":106819265,"uuid":"102882759","full_name":"khoi-backyard/swift-statsd-client","owner":"khoi-backyard","description":"📊 A StatsD Client written in Swift ","archived":false,"fork":false,"pushed_at":"2018-02-27T06:09:17.000Z","size":138,"stargazers_count":12,"open_issues_count":1,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-31T06:52:48.515Z","etag":null,"topics":["analytics","ios","metrics","statsd","statsd-client","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/khoi-backyard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-09-08T16:36:45.000Z","updated_at":"2022-01-21T08:15:56.000Z","dependencies_parsed_at":"2023-07-24T00:00:31.985Z","dependency_job_id":null,"html_url":"https://github.com/khoi-backyard/swift-statsd-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/khoi-backyard/swift-statsd-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khoi-backyard%2Fswift-statsd-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khoi-backyard%2Fswift-statsd-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khoi-backyard%2Fswift-statsd-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khoi-backyard%2Fswift-statsd-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khoi-backyard","download_url":"https://codeload.github.com/khoi-backyard/swift-statsd-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khoi-backyard%2Fswift-statsd-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29911552,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T19:37:42.220Z","status":"ssl_error","status_checked_at":"2026-02-27T19:37:41.463Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics","ios","metrics","statsd","statsd-client","swift"],"created_at":"2024-11-29T20:13:37.315Z","updated_at":"2026-02-27T20:13:59.160Z","avatar_url":"https://github.com/khoi-backyard.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Use [zalora/swift-statsd-client](https://github.com/zalora/swift-statsd-client) for the updated version.\n\n# swift-statsd-client\n\n[![CircleCI](https://circleci.com/gh/khoiracle/swift-statsd-client.svg?style=svg)](https://circleci.com/gh/khoiracle/swift-statsd-client)\n\nA Statsd Client written in Swift that is transport protocol agnostic. UDP and HTTP are supported out of the box.\n\n- [Requirements](#requirements)\n- [Usage](#usage)\n- [Installation](#installation)\n- [FAQ](#faq)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Requirements\n\n- iOS 9.0+ / macOS 10.11+ / tvOS 9.0+\n- Xcode 9.0+\n- Swift 4.0+\n\n## Usage\n\n### Initializing the client\n\nUDP Client\n```swift\nlet statsD = StatsD(transport: UDPTransport(host: \"localhost\", port: 2003))\n```\n\nTCPClient\n```swift\nlet statsD = StatsD(transport: TCPTransport(host: \"localhost\", port: 2003))\n```\n\nHTTP CLient\n```swift\nlet statsD = StatsD(transport: HTTPTransport(endpoint: URL(string: \"https://localhost:8888/statsd\")!)\n```\n\nAnd if you want to customize your HTTP request\n```swift\nlet statsD: StatsD = {\n    let configuration = URLSessionConfiguration()\n    configuration.httpAdditionalHeaders = [\"token\": \"Some Super Secret Token\"]\n    return StatsD(transport: HTTPTransport(endpoint: URL(string: \"https://localhost:8888/statsd\")!,\n                                      configuration: configuration))\n}()\n```\n\n### Sending Data\n\nSending metrics\n```swift\nstatsD.write(metric: Counting(name: \"counting\", value: 1))\nstatsD.write(metric: Sets(name: \"uniques\", value: \"765\"))\nstatsD.write(metric: Timing(name: \"glork\", value: 320))\nstatsD.write(metric: Gauge(name: \"gaugor\", value: 333))\n```\n\nSending metrics in batch - Keep in mind of your network's MTU [Ref](https://github.com/etsy/statsd/blob/master/docs/metric_types.md#multi-metric-packets)\n\nThere are helper functions so you don't have to create metric models.\n```swift\nstatsD.increment(\"foo\") # Increment 'foo' by 1\nstatsD.increment(\"foo\", by: 10) # Increment 'foo' by 10\nstatsD.set(\"uniques\", value: \"someUniqueValue\") # Add 'someUniqueValue' to the set\nstatsD.timing(\"api.foo.bar\", value: 320) # Set time for api.foo.bar\nstatsD.gauge(\"gaugor\", value: 10) # Set gauge to 10\nstatsD.gauge(\"gaugor\", delta: -10) # Decrement gauge by 10\n```\n\nAnd if you want to send raw metric data\n```\nstatsD.write(payload: \"foo:1|c\") \n```\n\n### Accessing\n\n## Installation\n\n### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.\n\nTo integrate StatsD into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"khoiracle/swift-statsd-client\"\n```\n\nThe project is currently configured to build for iOS, tvOS and Mac. After building with carthage the resultant frameworks will be stored in:\n\n* `Carthage/Build/iOS/StatsdClient.framework`\n* `Carthage/Build/tvOS/StatsdClient.framework`\n* `Carthage/Build/Mac/StatsdClient.framework`\n\nSelect the correct framework(s) and drag it into your project.\n\n## FAQ\n\n## Contributing\n\nSee [Contributing](https://github.com/khoiracle/swift-statsd-client/blob/master/CONTRIBUTING.md).\n\n## License\n\nswift-statsd-client is released under the MIT license. See [LICENSE](https://github.com/khoiracle/swift-statsd-client/blob/master/LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhoi-backyard%2Fswift-statsd-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhoi-backyard%2Fswift-statsd-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhoi-backyard%2Fswift-statsd-client/lists"}