示例#1
0
文件: rest.go 项目: fhermeni/wints
func internship(ex Exchange) error {
	start := time.Now()
	ss, err := ex.s.Internship(ex.V("s"))
	ms := int(time.Since(start).Nanoseconds() / 1000000)
	e := ex.outJSON(ss, err)

	logger.ReportValue("one internship", float64(ms))
	return e
}
示例#2
0
文件: mon.go 项目: fhermeni/wints
func logApi(method string, family, latency int) {

	//operation nature
	op := "write"
	if method == "GET" || method == "HEAD" {
		op = "read"
	}

	//The hit (2 metrics)
	lbl := fmt.Sprintf("API %s hit", op)
	logger.ReportHit(lbl)

	//The associated latency (2 metrics)
	lbl = fmt.Sprintf("API %s latency", op)
	logger.ReportValue(lbl, float64(latency))

	//The status code
	lbl = fmt.Sprintf("Status %dxx", family)
	logger.ReportHit(lbl)
}