技术控

    今日:80| 主题:49270
收藏本版 (1)
最新软件应用技术尽在掌握

[其他] goappmonitor:Golang 应用或业务性能监控

[复制链接]

立即注册CoLaBug.com会员,免费获得投稿人的专业资料,享用更多功能,玩转个人品牌!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x

goappmonitor:Golang 应用或业务性能监控-1 (following,function,business,provided,provides)

  goappmonitor

         
  Golang application performance data monitoring.
  GoAppMonitor is a library which provides a monitor on your golang applications. It contains system level based monitoring and business level monitoring(custom monitoring).Just add the repository into your apps and registe what you want to monitoring.
  Summary

  Using GoAppMonitor to monitor the golang applications, in general as following:
  In your golang application code, the user calls the statistics function provided by goappmonitor; when the statistics function is called, the appmonitor generates a statistical record, and is stored in memory.GoAppMonitor will automatically and regularly record these statistics push to the agent such as Open-Falcon agent.
  Version

  version support agent:
   v0.0.1 -Open-Falcon (Open source monitoring system of Xiaomi)
  todo....

  
       
  • support more type metrics,such as ewma and flow type.   
  • remove third-part library.   
  • support more agent frameworks,such as elasticsearch...  
  Install

  [code]go get github.com/wgliang/goappmonitor[/code]  Demo

goappmonitor:Golang 应用或业务性能监控-2 (following,function,business,provided,provides)

  Usage

   Below is an example which shows some common use cases for goappmonitor. Checkexample for more usage.
   DetailAPI
  [code]package main

import (
    "math/rand"
    "time"

    appm "github.com/wgliang/goappmonitor"
)

// Base or system perfomance 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.Int() % 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.Int()%100 - 50)
        appm.Gauge("appm.gauge", queueSize)

        cpuUtil := float64(rand.Int()%10000) / float64(100)
        appm.GaugeFloat64("appm.gauge.float64", cpuUtil)
    }
}

// Custom or business perfomance 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.Int() % 100)
        appm.Histogram("appm.histogram", delay)
    }
}

func main() {
    var ch chan int
    go baseOrsystem()
    go customOrbusiness()
    <-ch
}[/code]  Credits

   Repository is base on goperfcounter ofniean
   Logo is desigend byxuri
友荐云推荐




上一篇:高性能计算场景 IO 优化一例
下一篇:降维攻击:目标,比率指标
酷辣虫提示酷辣虫禁止发表任何与中华人民共和国法律有抵触的内容!所有内容由用户发布,并不代表酷辣虫的观点,酷辣虫无法对用户发布内容真实性提供任何的保证,请自行验证并承担风险与后果。如您有版权、违规等问题,请通过"联系我们"或"违规举报"告知我们处理。

*滑动验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

我要投稿

推荐阅读

扫码访问 @iTTTTT瑞翔 的微博
回页顶回复上一篇下一篇回列表手机版
手机版/CoLaBug.com ( 粤ICP备05003221号 | 文网文[2010]257号 )|网站地图 酷辣虫

© 2001-2016 Comsenz Inc. Design: Dean. DiscuzFans.

返回顶部 返回列表