Skip to content

Update Prometheus vendoring, adapt Cortex #668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@
name = "github.com/Azure/azure-sdk-for-go"
revision = "bd73d950fa4440dae889bd9917bff7cef539f86e"

[[override]]
name = "github.com/prometheus/common"
revision = "1bab55dd05dbff384524a6a1c99006d9eb5f139b"

[[override]]
name = "github.com/weaveworks/mesh"
revision = "5015f896ab62d3e9fe757456c757521ce0c3faff"

[[override]]
name = "github.com/grpc-ecosystem/grpc-gateway"
# This version is currently vendored in github.com/prometheus/prometheus,
# and newer versions have changed method signatures, so break the build.
revision = "589b126116b5fc961939b3e156c29e4d9d58222f"
3 changes: 3 additions & 0 deletions cmd/lite/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/prometheus/prometheus/config"
"github.com/prometheus/prometheus/promql"
"github.com/prometheus/prometheus/web/api/v1"
"github.com/prometheus/tsdb"
"google.golang.org/grpc"

"github.com/weaveworks/common/middleware"
Expand Down Expand Up @@ -155,6 +156,8 @@ func main() {
querier.DummyAlertmanagerRetriever{},
func() config.Config { return config.Config{} },
func(f http.HandlerFunc) http.HandlerFunc { return f },
func() *tsdb.DB { return nil }, // Only needed for admin APIs.
false, // Disable admin APIs.
)
promRouter := route.New().WithPrefix("/api/prom/api/v1")
api.Register(promRouter)
Expand Down
3 changes: 3 additions & 0 deletions cmd/querier/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/prometheus/prometheus/config"
"github.com/prometheus/prometheus/promql"
"github.com/prometheus/prometheus/web/api/v1"
"github.com/prometheus/tsdb"

"github.com/weaveworks/common/middleware"
"github.com/weaveworks/common/server"
Expand Down Expand Up @@ -98,6 +99,8 @@ func main() {
querier.DummyAlertmanagerRetriever{},
func() config.Config { return config.Config{} },
func(f http.HandlerFunc) http.HandlerFunc { return f },
func() *tsdb.DB { return nil }, // Only needed for admin APIs.
false, // Disable admin APIs.
)
promRouter := route.New().WithPrefix("/api/prom/api/v1")
api.Register(promRouter)
Expand Down
13 changes: 7 additions & 6 deletions pkg/querier/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,27 +195,28 @@ type mergeQuerier struct {
metadataOnly bool
}

func (mq mergeQuerier) Select(matchers ...*labels.Matcher) storage.SeriesSet {
func (mq mergeQuerier) Select(matchers ...*labels.Matcher) (storage.SeriesSet, error) {
// TODO: Update underlying selectors to return errors directly.
if mq.metadataOnly {
return mq.selectMetadata(matchers...)
return mq.selectMetadata(matchers...), nil
}
return mq.selectSamples(matchers...)
return mq.selectSamples(matchers...), nil
}

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

return set
return storage.NewMergeSeriesSet(seriesSets)
}

func (mq mergeQuerier) selectSamples(matchers ...*labels.Matcher) storage.SeriesSet {
Expand Down
3 changes: 2 additions & 1 deletion pkg/querier/querier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ func TestMergeQuerierSortsMetricLabels(t *testing.T) {
}
m, err := labels.NewMatcher(labels.MatchEqual, model.MetricNameLabel, "testmetric")
require.NoError(t, err)
ss := mq.Select(m)
ss, err := mq.Select(m)
require.NoError(t, err)
require.NoError(t, ss.Err())
ss.Next()
require.NoError(t, ss.Err())
Expand Down
Loading