🚀 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.
🔰 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()
go mgr.Start()
time.Sleep(time.Minute)
}
⚙️ Configuration
Statsview gets a variety of configurations for the users. Everyone could customize their favorite charts style.
WithInterval(interval int)
WithMaxPoints(n int)
WithTemplate(t string)
WithAddr(addr string)
WithLinkAddr(addr string)
WithTimeFormat(s string)
WithTheme(theme Theme)
Set the options
import (
"github.com/go-echarts/statsview"
"github.com/go-echarts/statsview/viewer"
)
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.
GCCPUFractionViewer
GCNumViewer
GCSizeViewer
GoroutinesViewer
HeapViewer
StackViewer
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