Refactor storage package errors (#17844)

Replace use of `tsdb/errors` with standard library `errors`.

Signed-off-by: SuperQ <superq@gmail.com>
This commit is contained in:
Ben Kochie 2026-01-13 09:53:49 +01:00 committed by GitHub
parent d9ed026658
commit 03a1d7a350
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,6 +17,7 @@ import (
"bytes"
"container/heap"
"context"
"errors"
"fmt"
"math"
"sync"
@ -25,7 +26,6 @@ import (
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/tsdb/chunkenc"
"github.com/prometheus/prometheus/tsdb/chunks"
tsdb_errors "github.com/prometheus/prometheus/tsdb/errors"
"github.com/prometheus/prometheus/util/annotations"
)
@ -269,13 +269,13 @@ func (q *mergeGenericQuerier) LabelNames(ctx context.Context, hints *LabelHints,
// Close releases the resources of the generic querier.
func (q *mergeGenericQuerier) Close() error {
errs := tsdb_errors.NewMulti()
var errs []error
for _, querier := range q.queriers {
if err := querier.Close(); err != nil {
errs.Add(err)
errs = append(errs, err)
}
}
return errs.Err()
return errors.Join(errs...)
}
func truncateToLimit(s []string, hints *LabelHints) []string {
@ -679,11 +679,11 @@ func (c *chainSampleIterator) Next() chunkenc.ValueType {
}
func (c *chainSampleIterator) Err() error {
errs := tsdb_errors.NewMulti()
var errs []error
for _, iter := range c.iterators {
errs.Add(iter.Err())
errs = append(errs, iter.Err())
}
return errs.Err()
return errors.Join(errs...)
}
type samplesIteratorHeap []chunkenc.Iterator
@ -821,12 +821,12 @@ func (c *compactChunkIterator) Next() bool {
}
func (c *compactChunkIterator) Err() error {
errs := tsdb_errors.NewMulti()
var errs []error
for _, iter := range c.iterators {
errs.Add(iter.Err())
errs = append(errs, iter.Err())
}
errs.Add(c.err)
return errs.Err()
errs = append(errs, c.err)
return errors.Join(errs...)
}
type chunkIteratorHeap []chunks.Iterator
@ -904,9 +904,9 @@ func (c *concatenatingChunkIterator) Next() bool {
}
func (c *concatenatingChunkIterator) Err() error {
errs := tsdb_errors.NewMulti()
var errs []error
for _, iter := range c.iterators {
errs.Add(iter.Err())
errs = append(errs, iter.Err())
}
return errs.Err()
return errors.Join(errs...)
}