Skip to content

Commit

Permalink
Update prometheus to 0.42.0
Browse files Browse the repository at this point in the history
Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
  • Loading branch information
fpetkovski committed Feb 13, 2023
1 parent 28c0347 commit 9ef9a9e
Show file tree
Hide file tree
Showing 16 changed files with 118 additions and 110 deletions.
26 changes: 13 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ require (
github.com/prometheus/alertmanager v0.25.0
github.com/prometheus/client_golang v1.14.0
github.com/prometheus/client_model v0.3.0
github.com/prometheus/common v0.39.1-0.20230110141620-846591a16635
github.com/prometheus/common v0.39.1-0.20230202092144-f9c1994be032
github.com/prometheus/exporter-toolkit v0.8.2
// Prometheus maps version 2.x.y to tags v0.x.y.
github.com/prometheus/prometheus v0.41.0
github.com/prometheus/prometheus v0.42.0
github.com/sony/gobreaker v0.5.0
github.com/stretchr/testify v1.8.1
github.com/thanos-community/promql-engine v0.0.0-20230124070417-9e293186b7e4
github.com/thanos-community/promql-engine v0.0.0-20230213101639-ab3d8dcea3f3
github.com/thanos-io/objstore v0.0.0-20230201072718-11ffbc490204
github.com/uber/jaeger-client-go v2.30.0+incompatible
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
Expand All @@ -89,9 +89,9 @@ require (
golang.org/x/sync v0.1.0
golang.org/x/text v0.6.0
golang.org/x/time v0.3.0
google.golang.org/api v0.104.0 // indirect
google.golang.org/api v0.108.0 // indirect
google.golang.org/genproto v0.0.0-20230131230820-1c016267d619 // indirect
google.golang.org/grpc v1.52.0
google.golang.org/grpc v1.52.1
google.golang.org/grpc/examples v0.0.0-20211119005141-f45e61797429
gopkg.in/alecthomas/kingpin.v2 v2.2.6
gopkg.in/fsnotify.v1 v1.4.7
Expand All @@ -106,7 +106,7 @@ require (

require (
cloud.google.com/go v0.105.0 // indirect
cloud.google.com/go/compute v1.13.0 // indirect
cloud.google.com/go/compute v1.14.0 // indirect
cloud.google.com/go/iam v0.8.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.2.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 // indirect
Expand All @@ -123,21 +123,21 @@ require (
require (
go.opentelemetry.io/contrib/propagators/autoprop v0.38.0
go4.org/intern v0.0.0-20220617035311-6925f38cc365
golang.org/x/exp v0.0.0-20221212164502-fae10dda9338
golang.org/x/exp v0.0.0-20230124195608-d38c7dcee874
)

require go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760 // indirect

require (
cloud.google.com/go/compute/metadata v0.2.2 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.32.3 // indirect
github.com/OneOfOne/xxhash v1.2.6 // indirect
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a // indirect
github.com/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
github.com/aws/aws-sdk-go v1.44.159 // indirect
github.com/aws/aws-sdk-go v1.44.187 // indirect
github.com/aws/aws-sdk-go-v2 v1.16.0 // indirect
github.com/aws/aws-sdk-go-v2/config v1.15.1 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.11.0 // indirect
Expand Down Expand Up @@ -183,9 +183,9 @@ require (
github.com/golang-jwt/jwt/v4 v4.4.3 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/pprof v0.0.0-20221212185716-aee1124e3a93 // indirect
github.com/google/pprof v0.0.0-20230111200839-76d1ae5aea2b // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.1 // indirect
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.1 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
Expand Down Expand Up @@ -240,9 +240,9 @@ require (
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/mod v0.7.0 // indirect
golang.org/x/oauth2 v0.3.0 // indirect
golang.org/x/oauth2 v0.4.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/tools v0.4.0 // indirect
golang.org/x/tools v0.5.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
gonum.org/v1/gonum v0.12.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down
70 changes: 36 additions & 34 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/cortex/querier/series/series_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (c *ConcreteSeries) Labels() labels.Labels {
}

// Iterator implements storage.Series
func (c *ConcreteSeries) Iterator() chunkenc.Iterator {
func (c *ConcreteSeries) Iterator(chunkenc.Iterator) chunkenc.Iterator {
return NewConcreteSeriesIterator(c)
}

Expand Down
6 changes: 4 additions & 2 deletions pkg/alert/alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ func (q *Queue) Push(alerts []*notifier.Alert) {
for _, l := range q.toAddLset {
lb.Set(l.Name, l.Value)
}
a.Labels = relabel.Process(lb.Labels(nil), q.alertRelabelConfigs...)
if a.Labels != nil {

var keep bool
a.Labels, keep = relabel.Process(lb.Labels(nil), q.alertRelabelConfigs...)
if keep {
relabeledAlerts = append(relabeledAlerts, a)
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/block/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ func (f *LabelShardedMetaFilter) Filter(_ context.Context, metas map[ulid.ULID]*
lbls = append(lbls, labels.Label{Name: k, Value: v})
}

if processedLabels := relabel.Process(lbls, f.relabelConfig...); len(processedLabels) == 0 {
if processedLabels, _ := relabel.Process(lbls, f.relabelConfig...); len(processedLabels) == 0 {
synced.WithLabelValues(labelExcludedMeta).Inc()
delete(metas, id)
}
Expand Down
12 changes: 7 additions & 5 deletions pkg/block/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ func GatherIndexHealthStats(logger log.Logger, fn string, minTime, maxTime int64
var (
lastLset labels.Labels
lset labels.Labels
builder labels.ScratchBuilder
chks []chunks.Meta

seriesLifeDuration = newMinMaxSumInt64()
Expand Down Expand Up @@ -251,9 +252,10 @@ func GatherIndexHealthStats(logger log.Logger, fn string, minTime, maxTime int64
id := p.At()
stats.TotalSeries++

if err := r.Series(id, &lset, &chks); err != nil {
if err := r.Series(id, &builder, &chks); err != nil {
return stats, errors.Wrap(err, "read series")
}
lset = builder.Labels()
if len(lset) == 0 {
return stats, errors.Errorf("empty label set detected for series %d", id)
}
Expand Down Expand Up @@ -567,16 +569,16 @@ func rewrite(
series = []seriesRepair{}
)

var lset labels.Labels
var builder labels.ScratchBuilder
var chks []chunks.Meta
for all.Next() {
id := all.At()

if err := indexr.Series(id, &lset, &chks); err != nil {
if err := indexr.Series(id, &builder, &chks); err != nil {
return errors.Wrap(err, "series")
}
// Make sure labels are in sorted order.
sort.Sort(lset)
builder.Sort()

for i, c := range chks {
chks[i].Chunk, err = chunkr.Chunk(c)
Expand All @@ -595,7 +597,7 @@ func rewrite(
}

series = append(series, seriesRepair{
lset: lset,
lset: builder.Labels(),
chks: chks,
})
}
Expand Down
7 changes: 4 additions & 3 deletions pkg/compact/downsample/downsample.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"golang.org/x/sync/errgroup"

"github.com/thanos-io/objstore"

"github.com/thanos-io/thanos/pkg/block"
"github.com/thanos-io/thanos/pkg/block/metadata"
"github.com/thanos-io/thanos/pkg/errutil"
Expand Down Expand Up @@ -112,20 +113,20 @@ func Downsample(
aggrChunks []*AggrChunk
all []sample
chks []chunks.Meta
lset labels.Labels
builder labels.ScratchBuilder
reuseIt chunkenc.Iterator
)
for postings.Next() {
lset = lset[:0]
chks = chks[:0]
all = all[:0]
aggrChunks = aggrChunks[:0]

// Get series labels and chunks. Downsampled data is sensitive to chunk boundaries
// and we need to preserve them to properly downsample previously downsampled data.
if err := indexr.Series(postings.At(), &lset, &chks); err != nil {
if err := indexr.Series(postings.At(), &builder, &chks); err != nil {
return id, errors.Wrapf(err, "get series %d", postings.At())
}
lset := builder.Labels()

for i, c := range chks[1:] {
if chks[i].MaxTime >= c.MinTime {
Expand Down
10 changes: 5 additions & 5 deletions pkg/compactv2/chunk_series_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type lazyPopulateChunkSeriesSet struct {
all index.Postings

bufChks []chunks.Meta
bufLbls labels.Labels
bufLbls labels.ScratchBuilder

curr *storage.ChunkSeriesEntry
err error
Expand Down Expand Up @@ -53,13 +53,13 @@ func (s *lazyPopulateChunkSeriesSet) Next() bool {
s.bufChks[i].Chunk = &lazyPopulatableChunk{cr: s.sReader.cr, m: &s.bufChks[i]}
}
s.curr = &storage.ChunkSeriesEntry{
Lset: make(labels.Labels, len(s.bufLbls)),
ChunkIteratorFn: func() chunks.Iterator {
Lset: make(labels.Labels, len(s.bufLbls.Labels())),
ChunkIteratorFn: func(chunks.Iterator) chunks.Iterator {
return storage.NewListChunkSeriesIterator(s.bufChks...)
},
}
// TODO: Do we need to copy this?
copy(s.curr.Lset, s.bufLbls)
copy(s.curr.Lset, s.bufLbls.Labels())
return true
}
return false
Expand Down Expand Up @@ -187,7 +187,7 @@ func (w *Compactor) write(ctx context.Context, symbols index.StringIter, populat
}

s := populatedSet.At()
chksIter := s.Iterator()
chksIter := s.Iterator(nil)
chks = chks[:0]
for chksIter.Next() {
// We are not iterating in streaming way over chunk as it's more efficient to do bulk write for index and
Expand Down
2 changes: 1 addition & 1 deletion pkg/compactv2/compactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (w *Compactor) WriteSeries(ctx context.Context, readers []block.Reader, sWr
}

s := set.At()
iter := s.Iterator()
iter := s.Iterator(nil)
for iter.Next() {
}
if err := iter.Err(); err != nil {
Expand Down
18 changes: 9 additions & 9 deletions pkg/compactv2/modifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ SeriesLoop:
}

// Special case: Delete whole series.
chksIter := s.Iterator()
chksIter := s.Iterator(nil)
var chks []chunks.Meta
for chksIter.Next() {
chks = append(chks, chksIter.At())
Expand All @@ -103,8 +103,8 @@ SeriesLoop:

d.curr = &storage.ChunkSeriesEntry{
Lset: lbls,
ChunkIteratorFn: func() chunks.Iterator {
return NewDelGenericSeriesIterator(s.Iterator(), intervals, func(intervals tombstones.Intervals) {
ChunkIteratorFn: func(it chunks.Iterator) chunks.Iterator {
return NewDelGenericSeriesIterator(s.Iterator(it), intervals, func(intervals tombstones.Intervals) {
d.log.DeleteSeries(lbls, intervals)
}).ToChunkSeriesIterator()
},
Expand Down Expand Up @@ -370,11 +370,11 @@ func (d *RelabelModifier) Modify(_ index.StringIter, set storage.ChunkSeriesSet,
for set.Next() {
s := set.At()
lbls := s.Labels()
chksIter := s.Iterator()
chksIter := s.Iterator(nil)

// The labels have to be copied because `relabel.Process` is now overwriting the original
// labels to same memory. This happens since Prometheus v2.39.0.
if processedLabels := relabel.Process(lbls.Copy(), d.relabels...); len(processedLabels) == 0 {
if processedLabels, _ := relabel.Process(lbls.Copy(), d.relabels...); len(processedLabels) == 0 {
// Special case: Delete whole series if no labels are present.
var (
minT int64 = math.MaxInt64
Expand Down Expand Up @@ -461,7 +461,7 @@ func newChunkSeriesBuilder(lset labels.Labels) *mergeChunkSeries {

func (s *mergeChunkSeries) addIter(iter chunkenc.Iterator) {
s.ss = append(s.ss, &storage.SeriesEntry{
SampleIteratorFn: func() chunkenc.Iterator {
SampleIteratorFn: func(iterator chunkenc.Iterator) chunkenc.Iterator {
return iter
},
})
Expand All @@ -471,15 +471,15 @@ func (s *mergeChunkSeries) Labels() labels.Labels {
return s.lset
}

func (s *mergeChunkSeries) Iterator() chunks.Iterator {
func (s *mergeChunkSeries) Iterator(iterator chunks.Iterator) chunks.Iterator {
if len(s.ss) == 0 {
return nil
}
if len(s.ss) == 1 {
return storage.NewSeriesToChunkEncoder(s.ss[0]).Iterator()
return storage.NewSeriesToChunkEncoder(s.ss[0]).Iterator(iterator)
}

return storage.NewSeriesToChunkEncoder(storage.ChainedSeriesMerge(s.ss...)).Iterator()
return storage.NewSeriesToChunkEncoder(storage.ChainedSeriesMerge(s.ss...)).Iterator(iterator)
}

type errorOnlyStringIter struct {
Expand Down
12 changes: 6 additions & 6 deletions pkg/dedup/chunk_iter.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ func NewChunkSeriesMerger() storage.VerticalChunkSeriesMergeFunc {
}
return &storage.ChunkSeriesEntry{
Lset: series[0].Labels(),
ChunkIteratorFn: func() chunks.Iterator {
ChunkIteratorFn: func(iterator chunks.Iterator) chunks.Iterator {
iterators := make([]chunks.Iterator, 0, len(series))
for _, s := range series {
iterators = append(iterators, s.Iterator())
iterators = append(iterators, s.Iterator(iterator))
}
return &dedupChunksIterator{
iterators: iterators,
Expand Down Expand Up @@ -196,13 +196,13 @@ func (o *overlappingMerger) iterator(baseChk chunks.Meta) chunks.Iterator {
case chunkenc.EncXOR:
// If XOR encoding, we need to deduplicate the samples and re-encode them to chunks.
return storage.NewSeriesToChunkEncoder(&storage.SeriesEntry{
SampleIteratorFn: func() chunkenc.Iterator {
SampleIteratorFn: func(iterator chunkenc.Iterator) chunkenc.Iterator {
it = baseChk.Chunk.Iterator(nil)
for _, i := range o.xorIterators {
it = o.samplesMergeFunc(it, i)
}
return it
}}).Iterator()
}}).Iterator(nil)

case downsample.ChunkEncAggr:
// If Aggr encoding, each aggregated chunks need to be expanded and deduplicated,
Expand Down Expand Up @@ -243,10 +243,10 @@ func newAggrChunkIterator(iters [5]chunkenc.Iterator) chunks.Iterator {
return &aggrChunkIterator{
iters: iters,
countChkIter: storage.NewSeriesToChunkEncoder(&storage.SeriesEntry{
SampleIteratorFn: func() chunkenc.Iterator {
SampleIteratorFn: func(iterator chunkenc.Iterator) chunkenc.Iterator {
return iters[downsample.AggrCount]
},
}).Iterator(),
}).Iterator(nil),
}
}

Expand Down
Loading

0 comments on commit 9ef9a9e

Please sign in to comment.