GithubHelp home page GithubHelp logo

statsd's Introduction

####业务和性能监控系统

#####框架:

  1. statsd:数据收集。基于Node.Js
  2. graphite:数据源,同时也可用作前端展示
  3. grafana:前端展示

#####消息格式 [company.]proj.module.func.<count | value | timing>

  • companye:公司名,如ezbuy。作为公司内部使用,可省略以简化消息格式
  • proj:项目名,如dgadmin,bulma,trending等
  • module:模块名,项目中的具体模块
  • func:模块完成的功能,或者需监控的切入点,推荐以具体功能作为名称

#####备注 统计分为步进(Count),数值(Gauge)和时长(Timing)

#####应用场景

  • 登录次数:应为步进统计,消息格式可为 dgadmin.user.login.count
  • 商品价格:应为数值统计,消息格式可为 ezbuy.goods.price.value
  • 下单时长:应为时长统计,消息格式可为 ezbuy.order.place.timing

#####使用示例

import "github.com/ezbuy/statsd"

func login(){
	// user login

	// becase the prefix (usually set as project name) is retrieved from config file
	// so we just set the module & function name here
	statsd.Incr("user.login.count")
}

func getGoodsPrice() {
	// get goods price

	statsd.FGauge("goods.price.value", 100.5)
	// or
	statsd.Gauge("goods.price.value", 100)
}

func placeOrder() {
	t1 := statsd.Now()

	// heavy work

	t2 := statsd.Now()
	statsd.TimingByValue("order.place.timing", t2.Sub(t1))
	// or
	statsd.Timing("order.place.timing", t1, t2)
}

#####后续

  1. 时序数据库备份

statsd's People

Contributors

awkr avatar wuvist avatar hackerzgz avatar dtynn avatar zhaokongsheng avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.