Statsview
🚀 A real-time Golang runtime stats visualization profiler
Install / Use
/learn @go-echarts/StatsviewREADME
🚀 Statsview
Statsview is a real-time Golang runtime stats visualization profiler. It is built top on another open-source project, go-echarts, which helps statsview to show its graphs on the browser.
<a href="https://github.com/go-echarts/statsview/pulls"> <img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat" alt="Contributions welcome"> </a> <a href="https://goreportcard.com/report/github.com/go-echarts/statsview"> <img src="https://goreportcard.com/badge/github.com/go-echarts/statsview" alt="Go Report Card"> </a> <a href="https://opensource.org/licenses/MIT"> <img src="https://img.shields.io/badge/License-MIT-brightgreen.svg" alt="MIT License"> </a> <a href="https://pkg.go.dev/github.com/go-echarts/statsview"> <img src="https://godoc.org/github.com/go-echarts/statsview?status.svg" alt="GoDoc"> </a>🔰 Installation
$ go get -u github.com/go-echarts/statsview/...
📝 Usage
Statsview is quite simple to use and all static assets have been packaged into the project which makes it possible to run offline. It's worth pointing out that statsview has integrated the standard net/http/pprof hence statsview will be the only profiler you need.
package main
import (
"time"
"github.com/go-echarts/statsview"
)
func main() {
mgr := statsview.New()
// Start() runs a HTTP server at `localhost:18066` by default.
go mgr.Start()
// Stop() will shutdown the http server gracefully
// mgr.Stop()
// busy working....
time.Sleep(time.Minute)
}
// Visit your browser at http://localhost:18066/debug/statsview
// Or debug as always via http://localhost:18066/debug/pprof, http://localhost:18066/debug/pprof/heap, ...
⚙️ Configuration
Statsview gets a variety of configurations for the users. Everyone could customize their favorite charts style.
// WithInterval sets the interval(in Millisecond) of collecting and pulling metrics
// default -> 2000
WithInterval(interval int)
// WithMaxPoints sets the maximum points of each chart series
// default -> 30
WithMaxPoints(n int)
// WithTemplate sets the rendered template which fetching stats from the server and
// handling the metrics data
WithTemplate(t string)
// WithAddr sets the listening address and link address
// default -> "localhost:18066"
WithAddr(addr string)
// WithLinkAddr sets the html link address
// default -> "localhost:18066"
WithLinkAddr(addr string)
// WithTimeFormat sets the time format for the line-chart Y-axis label
// default -> "15:04:05"
WithTimeFormat(s string)
// WithTheme sets the theme of the charts
// default -> Macarons
//
// Optional:
// * ThemeWesteros
// * ThemeMacarons
WithTheme(theme Theme)
Set the options
import (
"github.com/go-echarts/statsview"
"github.com/go-echarts/statsview/viewer"
)
// set configurations before calling `statsview.New()` method
viewer.SetConfiguration(viewer.WithTheme(viewer.ThemeWesteros), viewer.WithAddr("localhost:8087"))
mgr := statsview.New()
go mgr.Start()
🗂 Viewers
Viewer is the abstraction of a Graph which in charge of collecting metrics from Runtime. Statsview provides some default viewers as below.
GCCPUFractionViewerGCNumViewerGCSizeViewerGoroutinesViewerHeapViewerStackViewer
Viewer wraps a go-echarts *charts.Line instance that means all options/features on it could be used. To be honest, I think that is the most charming thing about this project.
🔖 Snapshot
ThemeMacarons(default)

ThemeWesteros

📄 License
MIT ©chenjiandongx
Related Skills
node-connect
350.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
350.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
350.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
