{"id":14987702,"url":"https://github.com/msfidelis/gin-chaos-monkey","last_synced_at":"2025-04-12T00:17:14.927Z","repository":{"id":46223801,"uuid":"309896042","full_name":"msfidelis/gin-chaos-monkey","owner":"msfidelis","description":":cocktail: :cocktail: :cocktail: - Chaos Monkey assalts middleware for Gin Gonic ","archived":false,"fork":false,"pushed_at":"2021-11-05T14:41:29.000Z","size":151,"stargazers_count":20,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-12T00:17:08.253Z","etag":null,"topics":["chaos-engineering","chaos-monkey","gin-gonic","gin-middleware"],"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/msfidelis.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}},"created_at":"2020-11-04T05:19:34.000Z","updated_at":"2024-09-28T22:06:21.000Z","dependencies_parsed_at":"2022-09-26T18:41:25.121Z","dependency_job_id":null,"html_url":"https://github.com/msfidelis/gin-chaos-monkey","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msfidelis%2Fgin-chaos-monkey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msfidelis%2Fgin-chaos-monkey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msfidelis%2Fgin-chaos-monkey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msfidelis%2Fgin-chaos-monkey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msfidelis","download_url":"https://codeload.github.com/msfidelis/gin-chaos-monkey/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248497817,"owners_count":21113984,"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":["chaos-engineering","chaos-monkey","gin-gonic","gin-middleware"],"created_at":"2024-09-24T14:15:14.150Z","updated_at":"2025-04-12T00:17:14.899Z","avatar_url":"https://github.com/msfidelis.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Gin Chaos Monkey - Assault Middleware for Gin :cocktail: :cocktail: :cocktail:\n\n\u003cdiv align=\u003e\n\t\u003cimg align=\"right\" width=\"150px\" src=\"/.github/assets/img/color.png\"\u003e\n\u003c/div\u003e \n\n\n\u003cbr\u003e\u003cbr\u003e\n\n## Contents\n\n- [Gin Web Framework](https://github.com/gin-gonic/gin)\n  - [Installation](#installation)\n  - [Usage](#usage)\n  - [Assault types](#assault-types)\n  - [Environment variables configuration](#environment-variables-configuration)\n  - [Development](#development)\n\n## Installation \n\n```\ngo get -v github.com/msfidelis/gin-chaos-monkey\n```\n\n\u003cbr\u003e\u003cbr\u003e\n\n# Usage \n\n## Basic Usage\n\n```go\npackage main\n\nimport (\n\tchaos \"github.com/msfidelis/gin-chaos-monkey\"\n\t\"github.com/gin-gonic/gin\"\n)\n\nfunc main() {\n\tr := gin.Default()\n\n        //Middlewares\n        r.Use(gin.Recovery())\n        r.Use(chaos.Load())\n\n\t// Healthcheck\n\tr.GET(\"/healthcheck\", healthcheck.Ok)    \n\n\tr.Run()\n}\n```\n\n## Specific Routes\n\n```golang\n\npackage main\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\tchaos \"github.com/msfidelis/gin-chaos-monkey\"\n)\n\nfunc main() {\n\trouter := gin.Default()\n\n\t//Enable Chaos Monkey in Specific Route\n\trouter.GET(\"/healthcheck/chaos\", chaos.Load(), healthcheck.Ok)\n\n\trouter.GET(\"/healthcheck\", healthcheck.Ok)\n\n\trouter.Run()\n}\n```\n\n# ASSAULT TYPES\n\n\n### LATENCY ASSAULT \n\nThis assault increase latency on response time for web requests. You can set `CHAOS_MONKEY_LATENCY_MAX_TIMEOUT` environment variable to customize a max time to increase in requests. \n\n\n### EXCEPTION ASSAULT\n\nThis assault randomly returns 5xx errors for HTTP requests. You can set `CHAOS_MONKEY_EXCEPTION_HTTP_STATUS_CODE` to customize status codes to return in HTTP exception. Default: `503`\n\n\n### APP KILLER ASSAULT\n\nThis assault randomly inject an `panic` exception on application runtime\n\n### MEMORY ASSAULT \n\nIncreases the RAM consumption of the application\n\n### CPU ASSAULT \n\nIncreases the CPU consumption of the application\n\n# CONFIGURATION \n\n## Enable Chaos Monkey Assalts\n\n```bash\nexport CHAOS_MONKEY_ENABLED=true\nexport CHAOS_MONKEY_MODE=soft\nexport CHAOS_MONKEY_LATENCY=true\nexport CHAOS_MONKEY_LATENCY_MIN_TIME=5000\nexport CHAOS_MONKEY_LATENCY_MAX_TIME=10000\n```\n\n## Environment Variables Configuration \n\n| VARIABLE                                  | OPTIONS               \t| DEFAULT   | \n| ----------------------------------------- | --------------------------| --------- |\n| CHAOS_MONKEY_ENABLED                      | true/false            \t| false     |\n| CHAOS_MONKEY_MODE                         | soft/hard/critical/hell\t| soft      |\n| CHAOS_MONKEY_LATENCY                      | true/false            \t| false     |\n| CHAOS_MONKEY_LATENCY_MIN_TIME       \t\t| miliseconds           \t| max_time  |\n| CHAOS_MONKEY_LATENCY_MAX_TIME       \t\t| miliseconds           \t| 1000      |\n| CHAOS_MONKEY_EXCEPTION                    | true/false            \t| false     |\n| CHAOS_MONKEY_EXCEPTION_HTTP_STATUS_CODE   | 5xx                   \t| 503       |\n| CHAOS_MONKEY_APP_KILLER                   | true/false            \t| false     |\n| CHAOS_MONKEY_MEMORY                       | true/false            \t| false     |\n| CHAOS_MONKEY_CPU                       \t| true/false            \t| false     |\n\n## Development \n\n### Running Tests \n\n```\ngo test -v\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsfidelis%2Fgin-chaos-monkey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsfidelis%2Fgin-chaos-monkey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsfidelis%2Fgin-chaos-monkey/lists"}