Skip to content

Commit

Permalink
Skip stale postings in /active_series (#9580)
Browse files Browse the repository at this point in the history
* Skip stale postings in `/active_series`

* changelog

# Conflicts:
#	CHANGELOG.md
  • Loading branch information
flxbk authored Oct 18, 2024
1 parent 006e3f8 commit 4e66244
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
* [BUGFIX] Fix issue where `metric might not be a counter, name does not end in _total/_sum/_count/_bucket` annotation would be emitted even if `rate` or `increase` did not have enough samples to compute a result. #9508
* [BUGFIX] Fix issue where sharded queries could return annotations with incorrect or confusing position information. #9536
* [BUGFIX] Fix issue where downstream consumers may not generate correct cache keys for experimental error caching. #9644
* [BUGFIX] Fix issue where active series requests error when encountering a stale posting. #9580

### Mixin

Expand Down
5 changes: 5 additions & 0 deletions pkg/ingester/active_series.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/go-kit/log/level"
"github.com/grafana/dskit/tenant"
"github.com/pkg/errors"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/tsdb"
Expand Down Expand Up @@ -77,6 +78,10 @@ func (i *Ingester) ActiveSeries(request *client.ActiveSeriesRequest, stream clie
seriesRef, count := postings.AtBucketCount()
err = idx.Series(seriesRef, &buf, nil)
if err != nil {
// Postings may be stale. Skip if no underlying series exists.
if errors.Is(err, storage.ErrNotFound) {
continue
}
return fmt.Errorf("error getting series: %w", err)
}
m := &mimirpb.Metric{Labels: mimirpb.FromLabelsToLabelAdapters(buf.Labels())}
Expand Down

0 comments on commit 4e66244

Please sign in to comment.