{"id":13590983,"url":"https://github.com/zengming00/go-qps","last_synced_at":"2025-08-17T05:31:22.648Z","repository":{"id":57529898,"uuid":"139783569","full_name":"zengming00/go-qps","owner":"zengming00","description":null,"archived":false,"fork":false,"pushed_at":"2018-07-06T02:07:14.000Z","size":303,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T01:24:48.347Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/zengming00.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":"2018-07-05T02:10:19.000Z","updated_at":"2022-10-21T03:30:49.000Z","dependencies_parsed_at":"2022-08-27T14:46:54.664Z","dependency_job_id":null,"html_url":"https://github.com/zengming00/go-qps","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zengming00/go-qps","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zengming00%2Fgo-qps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zengming00%2Fgo-qps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zengming00%2Fgo-qps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zengming00%2Fgo-qps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zengming00","download_url":"https://codeload.github.com/zengming00/go-qps/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zengming00%2Fgo-qps/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270810874,"owners_count":24650007,"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","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-08-01T16:00:52.426Z","updated_at":"2025-08-17T05:31:22.172Z","avatar_url":"https://github.com/zengming00.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# go-qps\nqps(Query Per Second), qph(Hour), qpm(Minute)\n\n![image](https://github.com/zengming00/go-qps/raw/master/screenshots/1.jpg)\n\n```go\npackage main\n\nimport (\n\t\"math/rand\"\n\t\"net/http\"\n\t\"time\"\n\n\tmqps \"github.com/zengming00/go-qps\"\n)\n\nfunc main() {\n\trand.Seed(time.Now().UnixNano())\n\n\t// Statistics every second, a total of 3600 data\n\tqps := mqps.NewQP(time.Second, 3600)\n\tfor i := 0; i \u003c 5; i++ {\n\t\tgo func() {\n\t\t\tfor {\n\t\t\t\t// Call Count() on every goroutine that needs statistics\n\t\t\t\tqps.Count()\n\t\t\t\ttime.Sleep(time.Millisecond * time.Duration((50 + rand.Intn(500))))\n\t\t\t}\n\t\t}()\n\t}\n\t// Add a route to get HTML, for example /qps\n\thttp.HandleFunc(\"/qps\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\t\t// Get the raw HTML, you can gzip it\n\t\ts, err := qps.Show()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tw.Write([]byte(s))\n\t})\n\t// Add a route to get json report, The name is the same as getting the HTML routing, but you need to add the '_json' suffix\n\thttp.HandleFunc(\"/qps_json\", func(w http.ResponseWriter, r *http.Request) {\n\t\t// Get the json report\n\t\tbts, err := qps.GetJson()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Write(bts)\n\t})\n\terr := http.ListenAndServe(\":8080\", nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzengming00%2Fgo-qps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzengming00%2Fgo-qps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzengming00%2Fgo-qps/lists"}