Skip to content

Commit e19107b

Browse files
juliusvjml
authored andcommitted
Update Prometheus vendoring, adapt Cortex (#668)
* Update vendored Prometheus packages and transient deps * Make Cortex work with updated Prometheus packages The most noticeable change is around the lifecycle manager of the Alertmanager notifier and its associated service discovery manager. This has now been moved from the notifier package into main.go in Prometheus and thus we also need to duplicate that lifecycle management ourselves. * Ruler comment fixups / additions
1 parent 3108397 commit e19107b

File tree

163 files changed

+9349
-4537
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+9349
-4537
lines changed

Gopkg.lock

Lines changed: 11 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,6 @@
2222
name = "github.com/Azure/azure-sdk-for-go"
2323
revision = "bd73d950fa4440dae889bd9917bff7cef539f86e"
2424

25-
[[override]]
26-
name = "github.com/prometheus/common"
27-
revision = "1bab55dd05dbff384524a6a1c99006d9eb5f139b"
28-
2925
[[override]]
3026
name = "github.com/weaveworks/mesh"
3127
revision = "5015f896ab62d3e9fe757456c757521ce0c3faff"
32-
33-
[[override]]
34-
name = "github.com/grpc-ecosystem/grpc-gateway"
35-
# This version is currently vendored in github.com/prometheus/prometheus,
36-
# and newer versions have changed method signatures, so break the build.
37-
revision = "589b126116b5fc961939b3e156c29e4d9d58222f"

cmd/lite/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/prometheus/prometheus/config"
1414
"github.com/prometheus/prometheus/promql"
1515
"github.com/prometheus/prometheus/web/api/v1"
16+
"github.com/prometheus/tsdb"
1617
"google.golang.org/grpc"
1718

1819
"github.com/weaveworks/common/middleware"
@@ -155,6 +156,8 @@ func main() {
155156
querier.DummyAlertmanagerRetriever{},
156157
func() config.Config { return config.Config{} },
157158
func(f http.HandlerFunc) http.HandlerFunc { return f },
159+
func() *tsdb.DB { return nil }, // Only needed for admin APIs.
160+
false, // Disable admin APIs.
158161
)
159162
promRouter := route.New().WithPrefix("/api/prom/api/v1")
160163
api.Register(promRouter)

cmd/querier/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/prometheus/prometheus/config"
1414
"github.com/prometheus/prometheus/promql"
1515
"github.com/prometheus/prometheus/web/api/v1"
16+
"github.com/prometheus/tsdb"
1617

1718
"github.com/weaveworks/common/middleware"
1819
"github.com/weaveworks/common/server"
@@ -98,6 +99,8 @@ func main() {
9899
querier.DummyAlertmanagerRetriever{},
99100
func() config.Config { return config.Config{} },
100101
func(f http.HandlerFunc) http.HandlerFunc { return f },
102+
func() *tsdb.DB { return nil }, // Only needed for admin APIs.
103+
false, // Disable admin APIs.
101104
)
102105
promRouter := route.New().WithPrefix("/api/prom/api/v1")
103106
api.Register(promRouter)

pkg/querier/querier.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,27 +195,28 @@ type mergeQuerier struct {
195195
metadataOnly bool
196196
}
197197

198-
func (mq mergeQuerier) Select(matchers ...*labels.Matcher) storage.SeriesSet {
198+
func (mq mergeQuerier) Select(matchers ...*labels.Matcher) (storage.SeriesSet, error) {
199+
// TODO: Update underlying selectors to return errors directly.
199200
if mq.metadataOnly {
200-
return mq.selectMetadata(matchers...)
201+
return mq.selectMetadata(matchers...), nil
201202
}
202-
return mq.selectSamples(matchers...)
203+
return mq.selectSamples(matchers...), nil
203204
}
204205

205206
func (mq mergeQuerier) selectMetadata(matchers ...*labels.Matcher) storage.SeriesSet {
206207
// NB that we don't do this in parallel, as in practice we only have two queriers,
207208
// one of which is the chunk store, which doesn't implement this yet.
208-
var set storage.SeriesSet
209+
seriesSets := make([]storage.SeriesSet, 0, len(mq.queriers))
209210
for _, q := range mq.queriers {
210211
ms, err := q.MetricsForLabelMatchers(mq.ctx, model.Time(mq.mint), model.Time(mq.maxt), matchers...)
211212
if err != nil {
212213
return errSeriesSet{err: err}
213214
}
214215
ss := metricsToSeriesSet(ms)
215-
set = storage.DeduplicateSeriesSet(set, ss)
216+
seriesSets = append(seriesSets, ss)
216217
}
217218

218-
return set
219+
return storage.NewMergeSeriesSet(seriesSets)
219220
}
220221

221222
func (mq mergeQuerier) selectSamples(matchers ...*labels.Matcher) storage.SeriesSet {

pkg/querier/querier_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ func TestMergeQuerierSortsMetricLabels(t *testing.T) {
110110
}
111111
m, err := labels.NewMatcher(labels.MatchEqual, model.MetricNameLabel, "testmetric")
112112
require.NoError(t, err)
113-
ss := mq.Select(m)
113+
ss, err := mq.Select(m)
114+
require.NoError(t, err)
114115
require.NoError(t, ss.Err())
115116
ss.Next()
116117
require.NoError(t, ss.Err())

0 commit comments

Comments
 (0)