Metrics capturing erroneous API and Driver invocations do not capture the error
unmarshall opened this issue · comments
Madhav Bhargava commented
What happened:
All methods in helpers have the following first statement:
defer instrument.RecordAzAPIMetric(err, <label-Name>, time.Now())
Unfortunately this will always have the error has nil even when using named returned types. The correct way to invoke this should be:
defer func(currentTime time.Time) {
instrument.RecordAzAPIMetric(err, <label-Name>, currentTime)
}(time.Now)
This will ensure that if there is an error captured in the method then it will be made available to the deferred function.
What you expected to happen:
If there is an error in the API call then it should have been captured as a error metrics.