{"id":18993033,"url":"https://github.com/bakins/lua-resty-statsd","last_synced_at":"2025-07-09T18:33:55.892Z","repository":{"id":136985747,"uuid":"85857412","full_name":"bakins/lua-resty-statsd","owner":"bakins","description":"Statsd client for OpenResty","archived":false,"fork":false,"pushed_at":"2018-08-21T19:00:31.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T10:45:09.436Z","etag":null,"topics":["lua","openresty","statsd"],"latest_commit_sha":null,"homepage":null,"language":"Lua","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/bakins.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2017-03-22T17:33:17.000Z","updated_at":"2018-12-05T15:32:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"639e4add-e59e-4aa0-8961-97b947af8b92","html_url":"https://github.com/bakins/lua-resty-statsd","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bakins/lua-resty-statsd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakins%2Flua-resty-statsd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakins%2Flua-resty-statsd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakins%2Flua-resty-statsd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakins%2Flua-resty-statsd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bakins","download_url":"https://codeload.github.com/bakins/lua-resty-statsd/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakins%2Flua-resty-statsd/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264502387,"owners_count":23618587,"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":["lua","openresty","statsd"],"created_at":"2024-11-08T17:19:40.470Z","updated_at":"2025-07-09T18:33:55.853Z","avatar_url":"https://github.com/bakins.png","language":"Lua","readme":"lua-resty-statsd\n================\n\nStatsd client for [OpenResty](https://openresty.org/en/) that supports the\nextended/[datadog](http://docs.datadoghq.com/guides/dogstatsd/) protocol.\n\nStatus\n======\nThis library is considered production ready.\n\nUsage\n=====\n\nExample openresty/nginx config usage.\n```\ninit_worker_by_lua_block {\n  statsd = require(\"resty.statsd\").new({namespace=\"nginx\"})\n}\n\nserver {\n  log_by_lua_block{\n    statsd.count(\"requests\", 1, 1.0, {someLabel=\"someValue\"})\n  }\n}\n```\n\nMethods\n=======\n\nnew\n---\n\n`statsd = require(\"resty.statsd\").new(options)`\n\nCreate a new statsd client. You should create one of these and [reuse](https://github.com/openresty/lua-nginx-module#data-sharing-within-an-nginx-worker) it. The client uses a simple queue internally and pushes stats periodically.\n\nAn optional Lua table can be specified:\n* `host` - statsd host. default: _127.0.0.1_\n* `port` - statsd port. default: _8125_\n* `namespace` - this will be prefixed to every metric emitted. A namespace of \"foo\" and a metric name of \"bar\" would emit a metric named \"foo.bar\". There is no default.\n* `tags` -  a table of key=value lables that will be added to every metric.\n* `timeout` - socket timeout in miliseconds for send.default: _250_\n* `delay` - how often to send flush the metrics queue in miliseconds. default: _250_\n\n\ngauge\n-----\n\n`statsd:gauge(key, value, sample_rate, tags)`\n\nSet a gauge value. Value should be an integer.  \n\nIf sample_rate is nil, it defaults to 1.0 - ie, no sampling.\n\nTags is a table of key=value that will be merged with those passed to `new` - if any.\n\ncount\n-----\n\n`statsd:count(key, value, sample_rate, tags)`\n\nIncrement a counter by value. To decrement,  use a negative integer.\n\nIf sample_rate is nil, it defaults to 1.0 - ie, no sampling.\n\nTags is a table of key=value that will be merged with those passed to `new` - if any.\n\ntiming\n-----\n\n`statsd:timing(key, value, sample_rate, tags)`\n\nRecord a timing. Value should be an integer in milliseconds.\n\nIf sample_rate is nil, it defaults to 1.0 - ie, no sampling.\n\nTags is a table of key=value that will be merged with those passed to `new` - if any.\n\n## LICENSE\n\n\nThis module is licensed under the BSD license.\n\nCopyright (C) 2016-2017, by Brian Akins\n\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\nRedistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\nRedistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbakins%2Flua-resty-statsd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbakins%2Flua-resty-statsd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbakins%2Flua-resty-statsd/lists"}