Exemplo n.º 1
0
func (hm *HttpMetrics) markSingleCode(statusCode int) {
	// TOOD(pquerna): profile to see if this is horrible
	hm.rcmutex.Lock()
	defer hm.rcmutex.Unlock()
	var meter gmetrics.Meter

	meter, ok := hm.ResponseCodes[statusCode]

	if !ok {
		hm.ResponseCodes[statusCode] = gmetrics.NewMeter()
		meter = hm.ResponseCodes[statusCode]
		gmetrics.Register(fmt.Sprintf("%s.http.status.%d", hm.prefix, statusCode), meter)
	}

	meter.Mark(1)
}
Exemplo n.º 2
0
func updateMeter(meter gmetrics.Meter, newValue uint64) {
	va := int64(newValue) - meter.Count()
	meter.Mark(int64(va))
}