{"id":13397023,"url":"https://github.com/arl/statsviz","last_synced_at":"2025-05-16T19:00:36.171Z","repository":{"id":38050888,"uuid":"287403351","full_name":"arl/statsviz","owner":"arl","description":"🚀 Visualise your Go program runtime metrics in real time in the browser","archived":false,"fork":false,"pushed_at":"2025-05-09T06:34:13.000Z","size":18352,"stargazers_count":3286,"open_issues_count":11,"forks_count":123,"subscribers_count":33,"default_branch":"main","last_synced_at":"2025-05-09T18:19:09.335Z","etag":null,"topics":["garbage-collector","go","golang","golang-library","hacktoberfest","live","metrics","monitoring","plots","runtime","stats","visualization"],"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/arl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["arl"]}},"created_at":"2020-08-14T00:00:41.000Z","updated_at":"2025-05-09T10:59:30.000Z","dependencies_parsed_at":"2023-09-24T17:57:20.873Z","dependency_job_id":"f2855ef8-d812-40db-8461-dfe970b0824e","html_url":"https://github.com/arl/statsviz","commit_stats":{"total_commits":161,"total_committers":9,"mean_commits":17.88888888888889,"dds":"0.35403726708074534","last_synced_commit":"cdd0a4c93c01f2f822a47d7453f51ca9e903b26d"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arl%2Fstatsviz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arl%2Fstatsviz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arl%2Fstatsviz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arl%2Fstatsviz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arl","download_url":"https://codeload.github.com/arl/statsviz/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254592367,"owners_count":22097010,"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":["garbage-collector","go","golang","golang-library","hacktoberfest","live","metrics","monitoring","plots","runtime","stats","visualization"],"created_at":"2024-07-30T18:01:09.569Z","updated_at":"2025-05-16T19:00:36.071Z","avatar_url":"https://github.com/arl.png","language":"Go","readme":"[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white\u0026style=round-square)](https://pkg.go.dev/github.com/arl/statsviz)\n[![Latest tag](https://img.shields.io/github/tag/arl/statsviz.svg)](https://github.com/arl/statsviz/tag/)\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)\n\n[![Test Actions Status](https://github.com/arl/statsviz/workflows/Tests-linux/badge.svg)](https://github.com/arl/statsviz/actions)\n[![Test Actions Status](https://github.com/arl/statsviz/workflows/Tests-others/badge.svg)](https://github.com/arl/statsviz/actions)\n[![codecov](https://codecov.io/gh/arl/statsviz/branch/main/graph/badge.svg)](https://codecov.io/gh/arl/statsviz)\n\n# Statsviz\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Statsviz Gopher Logo\" width=\"120\" src=\"https://raw.githubusercontent.com/arl/statsviz/readme-docs/logo.png?sanitize=true\"\u003e\n  \u003cimg alt=\"statsviz ui\" width=\"450\" align=\"right\" src=\"https://github.com/arl/statsviz/raw/readme-docs/window.png\"\u003e\n\u003c/p\u003e\n\u003cbr/\u003e\n\nVisualize real time plots of your Go program runtime metrics, including heap, objects, goroutines, GC pauses, scheduler and more, in your browser.\n\n\u003chr\u003e\n\n- [Statsviz](#statsviz)\n  - [Install](#install)\n  - [Usage](#usage)\n  - [Advanced Usage](#advanced-usage)\n  - [How Does That Work?](#how-does-that-work)\n  - [Documentation](#documentation)\n    - [Go API](#go-api)\n    - [User interface](#user-interface)\n    - [Plots](#plots)\n    - [User Plots](#user-plots)\n  - [Examples](#examples)\n  - [Questions / Troubleshooting](#questions--troubleshooting)\n  - [Contributing](#contributing)\n  - [Changelog](#changelog)\n  - [License: MIT](#license-mit)\n\n## Install\n\nDownload the latest version:\n\n```\ngo get github.com/arl/statsviz@latest\n```\n\nPlease note that, as new metrics are added to the `/runtime/metrics` package, new plots are added to Statsviz.\nThis also means that the presence of some plots on the dashboard depends on the Go version you're using.\n\nWhen in doubt, use the latest ;-)\n\n\n## Usage\n\nRegister `Statsviz` HTTP handlers with your application `http.ServeMux`.\n\n```go\nmux := http.NewServeMux()\nstatsviz.Register(mux)\n\ngo func() {\n    log.Println(http.ListenAndServe(\"localhost:8080\", mux))\n}()\n```\n\nOpen your browser at http://localhost:8080/debug/statsviz\n\n\n## Advanced Usage\n\nIf you want more control over Statsviz HTTP handlers, examples are:\n - you're using some HTTP framework\n - you want to place Statsviz handler behind some middleware\n\nthen use `statsviz.NewServer` to obtain a `Server` instance. Both the `Index()` and `Ws()` methods return `http.HandlerFunc`.\n\n```go\nsrv, err := statsviz.NewServer(); // Create server or handle error\nsrv.Index()                       // UI (dashboard) http.HandlerFunc\nsrv.Ws()                          // Websocket http.HandlerFunc\n```\n\nPlease look at examples of usage in the [Examples](_example) directory.\n\n\n## How Does That Work?\n\n`statsviz.Register` registers 2 HTTP handlers within the given `http.ServeMux`:\n\n- the `Index` handler serves Statsviz user interface at `/debug/statsviz` at the address served by your program.\n\n- The `Ws` serves a Websocket endpoint. When the browser connects to that endpoint, [runtime/metrics](https://pkg.go.dev/runtime/metrics) are sent to the browser, once per second.\n\nData points are in a browser-side circular-buffer.\n\n\n## Documentation\n\n### Go API\n\nCheck out the API reference on [pkg.go.dev](https://pkg.go.dev/github.com/arl/statsviz#section-documentation).\n\n### User interface\n\nControls at the top of the page act on all plots:\n\n\u003cimg alt=\"menu\" src=\"https://github.com/arl/statsviz/raw/readme-docs/menu-002.png\"\u003e\n\n- the groom shows/hides the vertical lines representing garbage collections.\n- the time range selector defines the visualized time span.\n- the play/pause icons stops and resume the refresh of the plots.\n- the light/dark selector switches between light and dark modes.\n\nOn top of each plot there are 2 icons:\n\n\u003cimg alt=\"menu\" src=\"https://github.com/arl/statsviz/raw/readme-docs/plot.menu-001.png\"\u003e\n\n- the camera downloads a PNG image of the plot.\n- the info icon shows details about the metrics displayed.\n\n### Plots\n\nDepending on your go version, some plots may not be available.\n\n#### Heap (global)\n\n\u003cimg width=\"50%\" alt=\"heap-global\" src=\"https://github.com/arl/statsviz/raw/readme-docs/runtime-metrics/heap-global.png\"\u003e\n\n#### Heap (details)\n\n\u003cimg width=\"50%\" alt=\"heap-details\" src=\"https://github.com/arl/statsviz/raw/readme-docs/runtime-metrics/heap-details.png\"\u003e\n\n#### Live Objects in Heap\n\n\u003cimg width=\"50%\" alt=\"live-objects\" src=\"https://github.com/arl/statsviz/raw/readme-docs/runtime-metrics/live-objects.png\"\u003e\n\n#### Live Bytes in Heap\n\n\u003cimg width=\"50%\" alt=\"live-bytes\" src=\"https://github.com/arl/statsviz/raw/readme-docs/runtime-metrics/live-bytes.png\"\u003e\n\n#### MSpan/MCache\n\n\u003cimg width=\"50%\" alt=\"mspan-mcache\" src=\"https://github.com/arl/statsviz/raw/readme-docs/runtime-metrics/mspan-mcache.png\"\u003e\n\n#### Memory classes\n\n\u003cimg width=\"50%\" alt=\"memory-classes\" src=\"https://github.com/arl/statsviz/raw/readme-docs/runtime-metrics/memory-classes.png\"\u003e\n\n#### Goroutines\n\n\u003cimg width=\"50%\" alt=\"goroutines\" src=\"https://github.com/arl/statsviz/raw/readme-docs/runtime-metrics/goroutines.png\"\u003e\n\n#### Size Classes\n\n\u003cimg width=\"50%\" alt=\"size-classes\" src=\"https://github.com/arl/statsviz/raw/readme-docs/runtime-metrics/size-classes.png\"\u003e\n\n#### GC Scan\n\n\u003cimg width=\"50%\" alt=\"gc-scan\" src=\"https://github.com/arl/statsviz/raw/readme-docs/runtime-metrics/gc-scan.png\"\u003e\n\n#### GC Cycles\n\n\u003cimg width=\"50%\" alt=\"gc-cycles\" src=\"https://github.com/arl/statsviz/raw/readme-docs/runtime-metrics/gc-cycles.png\"\u003e\n\n#### Stop-the-world Pause Latencies\n\n\u003cimg width=\"50%\" alt=\"gc-pauses\" src=\"https://github.com/arl/statsviz/raw/readme-docs/runtime-metrics/gc-pauses.png\"\u003e\n\n#### CPU Classes (GC)\n\n\u003cimg width=\"50%\" alt=\"cpu-classes-gc\" src=\"https://github.com/arl/statsviz/raw/readme-docs/runtime-metrics/cpu-classes-gc.png\"\u003e\n\n#### Time Goroutines Spend in 'Runnable' state\n\n\u003cimg width=\"50%\" alt=\"runnable-time\" src=\"https://github.com/arl/statsviz/raw/readme-docs/runtime-metrics/runnable-time.png\"\u003e\n\n#### Time Goroutines Spend Blocked on Mutexes\n\n\u003cimg width=\"50%\" alt=\"mutex-wait\" src=\"https://github.com/arl/statsviz/raw/readme-docs/runtime-metrics/mutex-wait.png\"\u003e\n\n#### Starting Size of Goroutines Stacks\n\n\u003cimg width=\"50%\" alt=\"gc-stack-size\" src=\"https://github.com/arl/statsviz/raw/readme-docs/runtime-metrics/gc-stack-size.png\"\u003e\n\n#### Goroutine Scheduling Events\n\n\u003cimg width=\"50%\" alt=\"sched-events\" src=\"https://github.com/arl/statsviz/raw/readme-docs/runtime-metrics/sched-events.png\"\u003e\n\n#### CGO Calls\n\n\u003cimg width=\"50%\" alt=\"cgo\" src=\"https://github.com/arl/statsviz/raw/readme-docs/runtime-metrics/cgo.png\"\u003e\n\n\n### User Plots\n\nSince `v0.6` you can add your own plots to Statsviz dashboard, in order to easily\nvisualize your application metrics next to runtime metrics.\n\nPlease see the [userplots example](_example/userplots/main.go).\n\n## Examples\n\nCheck out the [\\_example](./_example/README.md) directory to see various ways to use Statsviz, such as:\n\n- use of `http.DefaultServeMux` or your own `http.ServeMux`\n- wrap HTTP handler behind a middleware\n- register the web page at `/foo/bar` instead of `/debug/statsviz`\n- use `https://` rather than `http://`\n- register Statsviz handlers with various Go HTTP libraries/frameworks:\n  - [echo](https://github.com/labstack/echo/)\n  - [fasthttp](https://github.com/valyala/fasthttp)\n  - [fiber](https://github.com/gofiber/fiber/)\n  - [gin](https://github.com/gin-gonic/gin)\n  - and many others thanks to many contributors!\n\n## Questions / Troubleshooting\n\nEither use GitHub's [discussions](https://github.com/arl/statsviz/discussions) or come to say hi and ask a live question on [#statsviz channel on Gopher's slack](https://gophers.slack.com/archives/C043DU4NZ9D).\n\n## Contributing\n\nPlease use [issues](https://github.com/arl/statsviz/issues/new/choose) for bugs and feature requests.  \nPull-requests are always welcome!  \nMore details in [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## Changelog\n\nSee [CHANGELOG.md](./CHANGELOG.md).\n\n## License: MIT\n\nSee [LICENSE](LICENSE)\n","funding_links":["https://github.com/sponsors/arl"],"categories":["Go","开源类库","Performance","Open source library","Programming Languages","性能","Relational Databases","Go语言包管理","Repositories"],"sub_categories":["调试","HTTP Clients","Debugging","HTTP客户端","OpenGL","ORM"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farl%2Fstatsviz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farl%2Fstatsviz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farl%2Fstatsviz/lists"}