{"id":16473295,"url":"https://github.com/amalfra/gin-statsd","last_synced_at":"2025-03-16T18:31:32.774Z","repository":{"id":55070184,"uuid":"138324709","full_name":"amalfra/gin-statsd","owner":"amalfra","description":"A Gin middleware for reporting to statsd daemon","archived":false,"fork":false,"pushed_at":"2024-04-19T12:31:21.000Z","size":52,"stargazers_count":34,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-27T12:08:41.684Z","etag":null,"topics":["gin-middleware","golang","http","middleware","statsd"],"latest_commit_sha":null,"homepage":"","language":"Go","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/amalfra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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}},"created_at":"2018-06-22T16:27:39.000Z","updated_at":"2025-02-11T21:34:06.000Z","dependencies_parsed_at":"2023-12-23T06:54:54.140Z","dependency_job_id":"1ca2900b-4000-4a4c-8b38-21763f202917","html_url":"https://github.com/amalfra/gin-statsd","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amalfra%2Fgin-statsd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amalfra%2Fgin-statsd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amalfra%2Fgin-statsd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amalfra%2Fgin-statsd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amalfra","download_url":"https://codeload.github.com/amalfra/gin-statsd/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243826788,"owners_count":20354220,"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":["gin-middleware","golang","http","middleware","statsd"],"created_at":"2024-10-11T12:26:10.595Z","updated_at":"2025-03-16T18:31:32.146Z","avatar_url":"https://github.com/amalfra.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"gin-statsd\n========\n[![GitHub release](https://img.shields.io/github/release/amalfra/gin-statsd.svg)](https://github.com/amalfra/gin-statsd/releases)\n![Build Status](https://github.com/amalfra/gin-statsd/actions/workflows/test.yml/badge.svg?branch=main)\n[![GoDoc](https://godoc.org/github.com/amalfra/gin-statsd/v3?status.svg)](https://godoc.org/github.com/amalfra/gin-statsd/v3)\n[![Go Report Card](https://goreportcard.com/badge/github.com/amalfra/gin-statsd/v3)](https://goreportcard.com/report/github.com/amalfra/gin-statsd/v3)\n[![Coverage Status](https://coveralls.io/repos/github/amalfra/gin-statsd/badge.svg?branch=main)](https://coveralls.io/github/amalfra/gin-statsd?branch=main)\n\nA [Gin](https://github.com/gin-gonic/gin) middleware for reporting to statsd daemon.\n\n## Installation\nYou can download the middleware using\n```sh\ngo get github.com/amalfra/gin-statsd/v3\n```\n## Usage\nNext, import the package\n``` go\nimport (\n  statsdMiddleware \"github.com/amalfra/gin-statsd/v3/middleware\"\n)\n```\n\n1. Attach middleware to all routes\n``` go\n  r := gin.New()\n  r.Use(statsdMiddleware.New(statsdMiddleware.Options{}))\n```\n\nor \n\n2. Attach middleware to specific route\n``` go\n  r := gin.New()\n  r.GET(\"/\", statsdMiddleware.New(statsdMiddleware.Options{}), func(c *gin.Context) {})\n```\n\nBy default, the middleware will send status_code and response_time stats.\nAll stats are namespaced under `statsdKey` key by default. This can be configured using options.\n\n### Configuring using Options\nThe middleware allows configuring using Options struct. The struct with config should be passed when initializing with New method. Supported configurations are:\n\n* Host - statsd daemon's host; defaults to 127.0.0.1\n* Port - statsd daemon's port; defaults to 8125\n* RequestKey - the namespace for stats; defaults to statsdKey\n\nConfiguring namespace:\n``` go\n  r := gin.New()\n  r.Use(statsdMiddleware.New(statsdMiddleware.Options{RequestKey: \"myNamespace\"}))\n```\nConfiguring statsd host and port:\n``` go\n  r := gin.New()\n  r.Use(statsdMiddleware.New(statsdMiddleware.Options{Host: \"myhost.statsd\", Port: 8089}))\n```\n\n## Development\nQuestions, problems or suggestions? Please post them on the [issue tracker](https://github.com/amalfra/gin-statsd/issues).\n\nYou can contribute changes by forking the project and submitting a pull request. Feel free to contribute :heart_eyes:\n\n## UNDER MIT LICENSE\n\nThe MIT License (MIT)\n\nCopyright (c) 2018 Amal Francis\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famalfra%2Fgin-statsd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famalfra%2Fgin-statsd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famalfra%2Fgin-statsd/lists"}