Skip to content

Commit

Permalink
Upgraded Prometheus and TSDB deps.
Browse files Browse the repository at this point in the history
This PR does not add anything, however by upgrading Prometheus from 2.3.2 to master tip and same for TSDB it may affects few things.
Bigger packages we use and changes I found manually:
* prometheus/prometheus/discovery/file
  * [ENHANCEMENT] Discovery: Improve performance of previously slow updates of changes of targets. #4526 ?? cc @ivan-valkov
  * [BUGFIX] Wait for service discovery to stop before exiting #4508 ??
* prometheus/prometheus/promql:
  * [BUGFIX] PromQL: Fix a goroutine leak in the lexer/parser. #4858
  * [BUGFIX] Change max/min over_time to handle NaNs properly. #438
  * [BUGFIX] Check label name for `count_values` PromQL function. #4585
  * [BUGFIX] Ensure that vectors and matrices do not contain identical label-sets. #4589
  * [ENHANCEMENT] Optimize PromQL aggregations #4248
  * [BUGFIX] Only add LookbackDelta to vector selectors #4399
  * [BUGFIX] Reduce floating point errors in stddev and related functions #4533

* prometheus/prometheus/rules:
  * New metrics exposed! (prometheus evaluation!)
  * [ENHANCEMENT] Rules: Error out at load time for invalid templates, rather than at evaluation time. #4537

* prometheus/tsdb/index: Index reader optimizations.

There are things/fixes we may reuse in next PRs (TODO create gh issues for those):
* api changes (warnings support on Prometheus UI and Query API)
* UI fixes:
  * [ENHANCEMENT] Web UI: Support console queries at specific times. #4764
  * [ENHANCEMENT] Web UI: Avoid browser spell-checking in expression field. #472
* Use notifier package once prometheus/prometheus#5025 is merged.
* Ruler UI fixes:
 * [ENHANCEMENT] Show rule evaluation errors in UI #4457

Follopw up issues we can fix in further PRs:
* QueryAPI has now api/v1/labels that Thanos does not yet support. Created issue with details: #702
* #703

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
  • Loading branch information
bwplotka committed Jan 21, 2019
1 parent d2078ff commit efd58fb
Show file tree
Hide file tree
Showing 31 changed files with 574 additions and 349 deletions.
38 changes: 16 additions & 22 deletions Gopkg.lock

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

7 changes: 5 additions & 2 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ ignored = ["github.com/improbable-eng/thanos/benchmark/*"]
name = "github.com/prometheus/common"

[[constraint]]
version = "v2.3.2"
# TODO(bwplotka): Move to released version once our recent fixes will be merged & released.
revision = "6e08029b56ae17c49e133d92a2792f6f119f2cbd"
name = "github.com/prometheus/prometheus"

[[override]]
Expand All @@ -46,7 +47,9 @@ ignored = ["github.com/improbable-eng/thanos/benchmark/*"]

[[constraint]]
name = "github.com/prometheus/tsdb"
revision = "bd832fc8274e8fe63999ac749daaaff9d881241f"
# TODO(bwplotka): Move to upstream version once https://github.com/prometheus/tsdb/pull/492 is merged.
revision = "fd04e0963c04a1fbd891be7552b50f58e357f75c"
source = "github.com/bwplotka/tsdb"

[[constraint]]
branch = "master"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ PROMU ?= $(BIN_DIR)/promu-$(PROMU_VERSION)
PROMU_VERSION ?= 264dc36af9ea3103255063497636bd5713e3e9c1

# E2e test deps.
SUPPORTED_PROM_VERSIONS ?=v2.0.0 v2.2.1 v2.3.2 v2.4.3 v2.5.0
SUPPORTED_PROM_VERSIONS ?=v2.2.1 v2.3.2 v2.4.3 v2.5.0
ALERTMANAGER_VERSION ?=v0.15.2
MINIO_SERVER_VERSION ?=RELEASE.2018-10-06T00-15-16Z

Expand Down
10 changes: 5 additions & 5 deletions cmd/thanos/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ import (
"text/template"
"time"

"github.com/prometheus/tsdb/labels"

"github.com/go-kit/kit/log"
"github.com/improbable-eng/thanos/pkg/block"
"github.com/improbable-eng/thanos/pkg/block/metadata"
"github.com/improbable-eng/thanos/pkg/objstore/client"
"github.com/improbable-eng/thanos/pkg/runutil"
"github.com/improbable-eng/thanos/pkg/verifier"
Expand All @@ -23,6 +22,7 @@ import (
"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/tsdb/labels"
"golang.org/x/text/language"
"golang.org/x/text/message"
"gopkg.in/alecthomas/kingpin.v2"
Expand Down Expand Up @@ -254,7 +254,7 @@ func registerBucket(m map[string]setupFunc, app *kingpin.Application, name strin
defer cancel()

// Getting Metas.
var blockMetas []*block.Meta
var blockMetas []*metadata.Meta
if err = bkt.Iter(ctx, "", func(name string) error {
id, ok := block.IsBlockDir(name)
if !ok {
Expand All @@ -277,7 +277,7 @@ func registerBucket(m map[string]setupFunc, app *kingpin.Application, name strin
}
}

func printTable(blockMetas []*block.Meta, selectorLabels labels.Labels, sortBy []string) error {
func printTable(blockMetas []*metadata.Meta, selectorLabels labels.Labels, sortBy []string) error {
header := inspectColumns

var lines [][]string
Expand Down Expand Up @@ -355,7 +355,7 @@ func getKeysAlphabetically(labels map[string]string) []string {

// matchesSelector checks if blockMeta contains every label from
// the selector with the correct value
func matchesSelector(blockMeta *block.Meta, selectorLabels labels.Labels) bool {
func matchesSelector(blockMeta *metadata.Meta, selectorLabels labels.Labels) bool {
for _, l := range selectorLabels {
if v, ok := blockMeta.Thanos.Labels[l.Name]; !ok || v != l.Value {
return false
Expand Down
10 changes: 5 additions & 5 deletions cmd/thanos/downsample.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import (
"path/filepath"
"time"

"github.com/prometheus/tsdb/chunkenc"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/improbable-eng/thanos/pkg/block"
"github.com/improbable-eng/thanos/pkg/block/metadata"
"github.com/improbable-eng/thanos/pkg/compact/downsample"
"github.com/improbable-eng/thanos/pkg/objstore"
"github.com/improbable-eng/thanos/pkg/objstore/client"
Expand All @@ -23,6 +22,7 @@ import (
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/tsdb"
"github.com/prometheus/tsdb/chunkenc"
"gopkg.in/alecthomas/kingpin.v2"
)

Expand Down Expand Up @@ -105,7 +105,7 @@ func downsampleBucket(
if err := os.MkdirAll(dir, 0777); err != nil {
return errors.Wrap(err, "create dir")
}
var metas []*block.Meta
var metas []*metadata.Meta

err := bkt.Iter(ctx, "", func(name string) error {
id, ok := block.IsBlockDir(name)
Expand All @@ -119,7 +119,7 @@ func downsampleBucket(
}
defer runutil.CloseWithLogOnErr(logger, rc, "block reader")

var m block.Meta
var m metadata.Meta
if err := json.NewDecoder(rc).Decode(&m); err != nil {
return errors.Wrap(err, "decode meta")
}
Expand Down Expand Up @@ -201,7 +201,7 @@ func downsampleBucket(
return nil
}

func processDownsampling(ctx context.Context, logger log.Logger, bkt objstore.Bucket, m *block.Meta, dir string, resolution int64) error {
func processDownsampling(ctx context.Context, logger log.Logger, bkt objstore.Bucket, m *metadata.Meta, dir string, resolution int64) error {
begin := time.Now()
bdir := filepath.Join(dir, m.ULID.String())

Expand Down
11 changes: 10 additions & 1 deletion cmd/thanos/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,16 @@ func runQuery(
return stores.Get(), nil
}, selectorLset)
queryableCreator = query.NewQueryableCreator(logger, proxy, replicaLabel)
engine = promql.NewEngine(logger, reg, maxConcurrentQueries, queryTimeout)
engine = promql.NewEngine(
promql.EngineOpts{
Logger: logger,
Reg: reg,
MaxConcurrent: maxConcurrentQueries,
// TODO(bwplotka): Expose this as a flag: https://github.com/improbable-eng/thanos/issues/703
MaxSamples: math.MaxInt32,
Timeout: queryTimeout,
},
)
)
// Periodically update the store set with the addresses we see in our cluster.
{
Expand Down
11 changes: 4 additions & 7 deletions cmd/thanos/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ import (
"syscall"
"time"

"github.com/improbable-eng/thanos/pkg/extprom"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/improbable-eng/thanos/pkg/alert"
"github.com/improbable-eng/thanos/pkg/block"
"github.com/improbable-eng/thanos/pkg/block/metadata"
"github.com/improbable-eng/thanos/pkg/cluster"
"github.com/improbable-eng/thanos/pkg/discovery/cache"
"github.com/improbable-eng/thanos/pkg/discovery/dns"
"github.com/improbable-eng/thanos/pkg/extprom"
"github.com/improbable-eng/thanos/pkg/objstore/client"
"github.com/improbable-eng/thanos/pkg/runutil"
"github.com/improbable-eng/thanos/pkg/shipper"
Expand Down Expand Up @@ -290,7 +289,7 @@ func runRule(
ctx, cancel := context.WithCancel(context.Background())
ctx = tracing.ContextWithTracer(ctx, tracer)

notify := func(ctx context.Context, expr string, alerts ...*rules.Alert) error {
notify := func(ctx context.Context, expr string, alerts ...*rules.Alert) {
res := make([]*alert.Alert, 0, len(alerts))
for _, alrt := range alerts {
// Only send actually firing alerts.
Expand All @@ -309,8 +308,6 @@ func runRule(
res = append(res, a)
}
alertQ.Push(res)

return nil
}
mgr = rules.NewManager(&rules.ManagerOptions{
Context: ctx,
Expand Down Expand Up @@ -579,7 +576,7 @@ func runRule(
}
}()

s := shipper.New(logger, nil, dataDir, bkt, func() labels.Labels { return lset }, block.RulerSource)
s := shipper.New(logger, nil, dataDir, bkt, func() labels.Labels { return lset }, metadata.RulerSource)

ctx, cancel := context.WithCancel(context.Background())

Expand Down
Loading

0 comments on commit efd58fb

Please sign in to comment.