add AddError method to accumulator (#1536)
This commit is contained in:
committed by
Cameron Sparr
parent
986735234b
commit
e68f251df7
@@ -28,6 +28,7 @@ type Accumulator struct {
|
||||
sync.Mutex
|
||||
|
||||
Metrics []*Metric
|
||||
Errors []error
|
||||
debug bool
|
||||
}
|
||||
|
||||
@@ -84,6 +85,16 @@ func (a *Accumulator) AddFields(
|
||||
a.Metrics = append(a.Metrics, p)
|
||||
}
|
||||
|
||||
// AddError appends the given error to Accumulator.Errors.
|
||||
func (a *Accumulator) AddError(err error) {
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
a.Lock()
|
||||
a.Errors = append(a.Errors, err)
|
||||
a.Unlock()
|
||||
}
|
||||
|
||||
func (a *Accumulator) SetPrecision(precision, interval time.Duration) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user