Pass through storage errors in limitAppender.

This commit is contained in:
Brian Brazil 2017-05-25 17:11:29 +01:00
parent ab0ce4a8d9
commit 72a276e7ed
1 changed files with 4 additions and 4 deletions

View File

@ -238,11 +238,11 @@ type limitAppender struct {
func (app *limitAppender) Add(lset labels.Labels, t int64, v float64) (string, error) {
if app.i+1 > app.limit {
return "", errors.New("sample limit exceeded")
return "", fmt.Errorf("sample limit of %d exceeded", app.limit)
}
ref, err := app.Appender.Add(lset, t, v)
if err != nil {
return "", fmt.Errorf("sample limit of %d exceeded", app.limit)
return "", err
}
app.i++
return ref, nil
@ -250,11 +250,11 @@ func (app *limitAppender) Add(lset labels.Labels, t int64, v float64) (string, e
func (app *limitAppender) AddFast(ref string, t int64, v float64) error {
if app.i+1 > app.limit {
return errors.New("sample limit exceeded")
return fmt.Errorf("sample limit of %d exceeded", app.limit)
}
if err := app.Appender.AddFast(ref, t, v); err != nil {
return fmt.Errorf("sample limit of %d exceeded", app.limit)
return err
}
app.i++
return nil