func (gm *GenericMetrics) RecordCall(callID, callName string, callTime time.Time, callStarted chan bool) string {
	if callID == "" {
		hashData := []byte("GenericMetrics-" + callName + strconv.FormatFloat(float64(rand.Float32()), 'f', -1, 32))
		hash := fmt.Sprintf("%x", md5.Sum(hashData))
		// Go routines are utilized to avoid blocking the main thread in case of
		// resource contention with var outstandingCalls
		go gm.FireCallStart(hash, callName, callTime, callStarted)
		go gm.IncrementCallCount(callName)
		return hash
	} else {
		go gm.FireCallEnd(callID, callName, callTime, callStarted)
		return ""
	}
}
func (gm *GenericMetrics) RecordCall(callID, callName string, callTime time.Time, callStarted chan bool) string {
	if callID == "" {
		hashData := []byte("GenericMetrics-" + callName + strconv.FormatFloat(float64(rand.Float32()), 'f', -1, 32))
		hash := fmt.Sprintf("%x", md5.Sum(hashData))
		
		
		go gm.FireCallStart(hash, callName, callTime, callStarted)
		go gm.IncrementCallCount(callName)
		return hash
	} else {
		go gm.FireCallEnd(callID, callName, callTime, callStarted)
		return ""
	}
}
func ( gm * GenericMetrics ) RecordCall ( callID , callName string , callTime time . Time , callStarted chan bool ) string { if callID == " " { hashData := [ ] byte ( " " + callName + strconv . FormatFloat ( float64 ( rand . Float32 ( ) ) , 'f' , - 1 , 32 ) ) hash := fmt . Sprintf ( " " , md5 . Sum ( hashData ) ) // Go routines are utilized to avoid blocking the main thread in case of // resource contention with var outstandingCalls go gm . FireCallStart ( hash , callName , callTime , callStarted ) go gm . IncrementCallCount ( callName ) return hash } else { go gm . FireCallEnd ( callID , callName , callTime , callStarted ) return " " } }
// This function creates a hash of the callName and a randomly generated number.
// The hash serves to match the call invokation with the call's end, which is
// required to compute the call duration. The final metric is observed when the
// FireCallEnd function is called.
// If callID is empty, then we initiate the call with FireCallStart
// We use a channel holding 1 bool to ensure that the FireCallEnd is called AFTER
// the FireCallStart (because these are done in separate go routines)
This function creates a hash of the callName and a randomly generated number . The hash serves to match the call invokation with the call s end which is required to compute the call duration . The final metric is observed when the FireCallEnd function is called . If callID is empty then we initiate the call with FireCallStart We use a channel holding 1 bool to ensure that the FireCallEnd is called AFTER the FireCallStart ( because these are done in separate go routines )