文件名称:Go应用性能数据监控GoAppMonitor.zip
文件大小:168KB
文件格式:ZIP
更新时间:2022-08-07 21:06:35
开源项目
GoAppMonitor —— Golang 应用性能数据监控。这是一个 Go 开发库,为你的 Go 应用程序提供监控功能。包含系统级别的监控和业务级别监控。监控效果:示例代码:package main import ( "math/rand" "time" appm "github.com/wgliang/goappmonitor" ) // Base or system performance data,such as memeory,gc,network and so on. func baseOrsystem() { for _ = range time.Tick(time.Second * time.Duration(10)) { // (commonly used) Meter, used to sum and calculate the rate of change. Use scenarios // such as the number of home visits statistics, CG etc.. pv := int64(rand.Int31n(100)) appm.Meter("appm.meter", pv) appm.Meter("appm.meter.2", pv-50) // (commonly used) Gauge, used to preserve the value of the instantaneous value of the // type of record. Use scenarios such as statistical queue length, statistics CPU usage, // and so on. queueSize := int64(rand.Int31n(100) - 50) appm.Gauge("appm.gauge", queueSize) cpuUtil := float64(rand.Int31n(10000)) / float64(100) appm.GaugeFloat64("appm.gauge.float64", cpuUtil) } } // Custom or business performance data,such as qps,num of function be called, task queue and so on. func customOrbusiness() { for _ = range time.Tick(time.Second) { // Histogram, using the exponential decay sampling method, the probability distribution of // the statistical object is calculated. Using scenarios such as the probability distribution // of the statistics home page to access the delay delay := int64(rand.Int31n(100)) appm.Histogram("appm.histogram", delay) } } func main() { var ch chan int go baseOrsystem() go customOrbusiness() <-ch }
【文件预览】:
goappmonitor-master
----http_test.go(649B)
----pusher.go(12KB)
----debug.go(2KB)
----cfg.example.json(573B)
----debug_test.go(379B)
----metrics_test.go(3KB)
----struct.go(2KB)
----pusher_test.go(236B)
----doc()
--------API.md(6KB)
--------demo.png(87KB)
----httplib_test.go(4KB)
----cfg.json(573B)
----.travis.yml(252B)
----runtime_test.go(2KB)
----example()
--------main.go(1KB)
--------control.sh(2KB)
--------cfg.json(573B)
----LICENSE(11KB)
----README.md(4KB)
----httplib.go(11KB)
----http.go(5KB)
----logo.png(58KB)
----version.go(76B)
----.gitignore(266B)
----metrics.go(7KB)
----config.go(6KB)
----runtime.go(8KB)