예제 #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)
}