{"id":22683283,"url":"https://github.com/mtchavez/go-statsite","last_synced_at":"2025-03-29T14:40:16.089Z","repository":{"id":143221551,"uuid":"10251520","full_name":"mtchavez/go-statsite","owner":"mtchavez","description":"Go package to talk to Statsite","archived":false,"fork":false,"pushed_at":"2013-05-31T22:59:08.000Z","size":228,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-04T15:32:47.693Z","etag":null,"topics":["go","metrics","statsite"],"latest_commit_sha":null,"homepage":"https://github.com/armon/statsite","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mtchavez.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-05-23T19:22:06.000Z","updated_at":"2017-03-08T16:43:42.000Z","dependencies_parsed_at":"2023-03-17T04:50:55.868Z","dependency_job_id":null,"html_url":"https://github.com/mtchavez/go-statsite","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fgo-statsite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fgo-statsite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fgo-statsite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fgo-statsite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtchavez","download_url":"https://codeload.github.com/mtchavez/go-statsite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246200300,"owners_count":20739563,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["go","metrics","statsite"],"created_at":"2024-12-09T21:11:28.963Z","updated_at":"2025-03-29T14:40:16.058Z","avatar_url":"https://github.com/mtchavez.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"go-statsite [![Build Status](https://travis-ci.org/mtchavez/go-statsite.png)](https://travis-ci.org/mtchavez/go-statsite)\n===========\n\nGo package to talk to Statsite - https://github.com/armon/statsite\n\n## Requirements\n\n### Statsite\n\nFollow install instructions [here](https://github.com/armon/statsite#install) to get\nstatsite up and running\n\n## Installation\n\n```go\n  go get github.com/mtchavez/go-statsite/statsite\n```\n\n## Usage\n\n### Client\n\nSetting up a new client takes a string of the ip and port statsite is running on.\n\n```go\nclient, err := statsite.NewClient(\"0.0.0.0:8125\")\nif err != nil {\n  log.Println(\"Unable to connect to statsite: \", err)\n}\n```\nIf any error occurs connecting to statsite it will be returned in ```err```.\n\n### Sending Messages\n\nThe following messages are implemented as ```structs```.\n\n* Message - Generic message (takes a Key, Value and MType)\n* KVMsg - Key/Value message (takes a Key and a Value)\n* GMsg - Key/Value message compatible with statsd gauges (takes a Key and a Value)\n* TimeMsg - Timer message (takes a Key and a Value)\n* CountMsg - Counter message (takes a Key and a Value)\n* SetMsg - Unique Set message (takes a Key and a Value)\n\nExample:\n\n```\nclient, err := statsite.NewClient(\"0.0.0.0:8125\")\nif err != nil {\n  log.Println(\"Unable to connect to statsite: \", err)\n}\nmsg := \u0026statsite.CountMsg{\"rewards\", \"1\"}\nfor i := 0; i \u003c 20; i++ {\n  client.Emit(msg)\n}\n```\n\nYour statsite log should have similar output if successful:\n\n```\nMay 23 14:28:06 el-chavo-2.local statsite[20400] \u003cDebug\u003e: Accepted client connection: 127.0.0.1 64538 [8]\nMay 23 14:28:06 el-chavo-2.local statsite[20400] \u003cDebug\u003e: Closed client connection. [8]\nMay 23 14:28:06 el-chavo-2.local statsite[20400] \u003cDebug\u003e: Closed connection. [8]\ncounts.rewards|20.000000|1369344489\n```\n\n## Test\n\nTests use Gocheck for assertions. You can see more [here](http://labix.org/gocheck)\n\nThen run using the normal ```go test``` command\n\n## TODO\n\n* Add client integration tests\n* Implement Statsite binary protocol\n\n## License\n\nWritten by Chavez\n\nReleased under the MIT License: http://www.opensource.org/licenses/mit-license.php\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtchavez%2Fgo-statsite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtchavez%2Fgo-statsite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtchavez%2Fgo-statsite/lists"}