Example #1
0
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
}
Example #2
0
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)
}