{"id":13342864,"url":"https://github.com/mstoykov/xk6-counter","last_synced_at":"2025-04-08T18:32:19.400Z","repository":{"id":47556211,"uuid":"317184663","full_name":"mstoykov/xk6-counter","owner":"mstoykov","description":null,"archived":false,"fork":false,"pushed_at":"2021-08-24T09:14:19.000Z","size":37,"stargazers_count":8,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-23T17:12:03.386Z","etag":null,"topics":["xk6"],"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/mstoykov.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-30T10:15:00.000Z","updated_at":"2024-04-20T18:06:38.000Z","dependencies_parsed_at":"2022-09-11T09:52:06.604Z","dependency_job_id":null,"html_url":"https://github.com/mstoykov/xk6-counter","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mstoykov%2Fxk6-counter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mstoykov%2Fxk6-counter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mstoykov%2Fxk6-counter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mstoykov%2Fxk6-counter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mstoykov","download_url":"https://codeload.github.com/mstoykov/xk6-counter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247902405,"owners_count":21015441,"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":["xk6"],"created_at":"2024-07-29T19:30:06.360Z","updated_at":"2025-04-08T18:32:14.390Z","avatar_url":"https://github.com/mstoykov.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xk6-counter\n\nThis is a [k6](https://go.k6.io/k6) extension using the [xk6](https://github.com/grafana/xk6) system.\n\n| :exclamation: This is a proof of concept, isn't supported by the k6 team, and may break in the future. USE AT YOUR OWN RISK! |\n| ---------------------------------------------------------------------------------------------------------------------------- |\n\nThis projects implements a singular local counter(name is bad) that goes up. It will return the current value before\nincreasing it, and each VU will get a different value. Which means that it can be used to iterate over an array, where:\n1. only one element will be used by each VU \n2. the array doesn't need to be sharded between the VUs it will \"dynamically\" balance between them even if some elements take longer to process\n\n\n\n| This totally doesn't work in distributed manner, so if there are multiple k6 instances you will need a separate service (API endpoint) which to do it. |\n| ---------------------------------------------------------------------------------------------------------------------------- |\n\nPredominantly because of the above this is very unlikely to ever get in k6 in it's current form, so please don't open issues :D. \n\n## Build\n\nTo build a `k6` binary with this extension, first ensure you have the prerequisites:\n\n- [gvm](https://github.com/moovweb/gvm)\n- [Git](https://git-scm.com/)\n\nThen, install [xk6](https://github.com/grafana/xk6) and build your custom k6 binary with the Kafka extension:\n\n1. Install `xk6`:\n  ```shell\n  $ go install go.k6.io/xk6/cmd/xk6@latest\n  ```\n\n2. Build the binary:\n  ```shell\n  $ xk6 build --with github.com/mstoykov/xk6-counter@latest\n  ```\n\n# example\n\n```javascript\nimport counter from \"k6/x/counter\"\nexport default function() {\n    console.log(counter.up(), __VU, __ITER)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmstoykov%2Fxk6-counter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmstoykov%2Fxk6-counter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmstoykov%2Fxk6-counter/lists"}