Skip to content
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

[PLAT-104961] Upgrade thanos to main and v0.35.0 #26

Merged
merged 67 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
9514b72
UI: Don't always force tracing (#7062)
jacobbaungard Jan 15, 2024
ee69af3
go.mod: update Prometheus version (#7047)
GiedriusS Jan 15, 2024
6798023
Make RetryError and HaltError able to be fetched for root cause (#7043)
alexqyle Jan 15, 2024
5117a96
CI: Ensure static react-app is checked in (#7063)
jacobbaungard Jan 16, 2024
57e20b9
receive: disable overlapping compaction
GiedriusS Jan 16, 2024
a7b7a94
Receive: refactor handler for improved readability and organization (…
douglascamata Jan 17, 2024
98db046
Upgrade grpc to 1.57.2 (#7078)
hanyuting8 Jan 21, 2024
9535290
Store: acceptance test for proxy store (#7084)
MichaHoffmann Jan 22, 2024
00b1617
Fix lazy postings with zero length (#7083)
yeya24 Jan 22, 2024
b8d4c36
Store: fix label values edge case (#7082)
MichaHoffmann Jan 23, 2024
b21112f
receive: race condition in handler Close() when stopped early (#7087)
cincinnat Jan 24, 2024
6133436
receive: use async remote writing (#7045)
GiedriusS Jan 26, 2024
c3ac9dc
Stores: convert tests to not rely on slice labels (#7098)
MichaHoffmann Jan 27, 2024
63d2a21
all: get rid of query pushdown to simplify query path (#7014)
MichaHoffmann Jan 29, 2024
a95a746
Store: dont rely on slice labels continued
MichaHoffmann Jan 27, 2024
30bbd27
Update prometheus/prometheus (#7096)
fpetkovski Jan 31, 2024
959773c
receive/handler: fix locking twice (#7112)
GiedriusS Feb 1, 2024
eaaf597
fix minio store gateway err (#7114)
kartikaysaxena Feb 8, 2024
9d2f49f
receive/handler: do not double lock (#7124)
GiedriusS Feb 9, 2024
8393572
default to alertmanager v2 api (#7123)
jakekeeys Feb 9, 2024
65d4132
Receive: dont rely on slice labels (#7100)
MichaHoffmann Feb 9, 2024
10773e0
docs: update helm installation instruction
bavarianbidi Feb 12, 2024
db4bc5e
docs: run make docs for helm installation instruction
bavarianbidi Feb 12, 2024
536a7a5
Fixing log line for remote engine in debug mode (#7133)
pedro-stanaka Feb 12, 2024
759cd23
Adding new method on BucketedBytes to expose used memory (#7137)
pedro-stanaka Feb 14, 2024
0d805af
Adding InfraCloud as Enterprise support partner (#7141)
chetanpdeshmukh Feb 15, 2024
45d70f6
cache: attach object storage hash to iter key (#6880)
GiedriusS Feb 19, 2024
28d4957
Add support for extended promql functions in rule (#7105)
sdufel Feb 21, 2024
c170bcd
Extended func support - doc update (#7161)
sdufel Feb 22, 2024
919f806
Copy labels from remote instant queries (#7151)
fpetkovski Feb 22, 2024
2615ae7
e2e/query_frontend: add tests for explain/analyze (#7160)
GiedriusS Feb 23, 2024
f69234a
cache/caching_bucket: add path to hash (#7158)
GiedriusS Feb 23, 2024
ce6aeba
Allow using different listing strategies (#7134)
fpetkovski Feb 24, 2024
261c8e3
cache: implement the circuit breaker pattern for asynchronous set ope…
damnever Feb 25, 2024
eb720bf
bugfix: lazy posting optimization with wrong cardinality for estimati…
yeya24 Feb 26, 2024
67abf60
queryfrontend: fix analysis after API changes
GiedriusS Feb 26, 2024
a8ece96
Query UI: Add tenant box (#6867)
jacobbaungard Feb 27, 2024
634c2b6
receive: add support for globbing tenant specifiers (#7155)
GiedriusS Feb 27, 2024
1098034
.circleci: bump setup_docker_version version (#7177)
GiedriusS Mar 4, 2024
b4208d0
Unhide distributed execution mode
fpetkovski Mar 3, 2024
d0b6c6e
Add changelog entry
fpetkovski Mar 4, 2024
f38c407
cortex/querier: fix analysis merging (#7179)
GiedriusS Mar 5, 2024
387571f
Fix docs
fpetkovski Mar 5, 2024
6c2268b
Added platformengineers (#7181)
munir131 Mar 7, 2024
cf4bde8
Bump google.golang.org/protobuf to v1.33.0 (#7191)
danielmellado Mar 7, 2024
1256d60
downsample: retry objstore related errors
xBazilio Mar 7, 2024
4011022
downsample: retry objstore related errors
xBazilio Mar 7, 2024
71ba04a
fix: make responsive support page and change size of platform-enginee…
payalraviya Mar 7, 2024
a0f6ade
rule: do not turn off if resolving fails (#7192)
GiedriusS Mar 8, 2024
05f89f2
Query UI: Only show tenant box with enforcement on (#7186)
jacobbaungard Mar 8, 2024
94c8a5e
*: properly treat native histogram deduplication in chunk series merger
pedro-stanaka Feb 23, 2024
01613ea
Reloader: Add support for watching and decompressing Prometheus confi…
TheSpiritXIII Mar 12, 2024
efc378f
[FEAT] Adding blog post (#7202)
heliapb Mar 13, 2024
ac0ca8f
storepb: make ServerAsClient channels unbuffered
MichaHoffmann Mar 13, 2024
972f1f8
Add support for TSDB selector in querier (#7200)
fpetkovski Mar 14, 2024
36af2ba
Update thanos-io/promql-engine (#7215)
fpetkovski Mar 21, 2024
5362de9
expose NewPromSeriesSet (#7214)
yeya24 Mar 23, 2024
ee7af3d
[CHORE] adding auto GOMEMLIMIT flag (#7223)
nicolastakashi Mar 24, 2024
24471cb
bump objstore package version to latest main (#7228)
yeya24 Mar 25, 2024
62df22e
Query-frontend: fix missing redis username config (#7224)
thibaultmg Mar 25, 2024
fdcaf92
UI: Showing Block Size Stats (#7233)
outofrange Mar 26, 2024
1536dc2
Fix lazy expanded postings cache and bug of non equal matcher (#7220)
yeya24 Mar 27, 2024
79e60d1
Bump Prometheus to include new label regex optimization (#7232)
yeya24 Mar 28, 2024
fa9882c
update docs for receive routing only with limits (#7241)
alecrajeev Mar 28, 2024
2006007
Merge branch 'db_main' into pull-latest-main
jnyi Apr 4, 2024
2b3c102
cleanup unexpected diff from oss main
jnyi Apr 4, 2024
755401a
fix unit tests
jnyi Apr 4, 2024
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
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
make install-tool-deps
- go/save-cache
- setup_remote_docker:
version: 20.10.12
version: docker24
- run:
name: Create Secret if PR is not forked
# GCS integration tests are run only for author's PR that have write access, because these tests
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
- git-shallow-clone/checkout
- go/mod-download-cached
- setup_remote_docker:
version: 20.10.12
version: docker24
- attach_workspace:
at: .
# Register qemu to support multi-arch.
Expand All @@ -104,7 +104,7 @@ jobs:
- git-shallow-clone/checkout
- go/mod-download-cached
- setup_remote_docker:
version: 20.10.12
version: docker24
- attach_workspace:
at: .
- run: make tarballs-release
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/react.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ jobs:
restore-keys: |
${{ runner.os }}-node-

- run: CI=false make check-react-app
- run: make react-app-test
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,29 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re

### Fixed

- [#7083](https://github.com/thanos-io/thanos/pull/7083) Store Gateway: Fix lazy expanded postings with 0 length failed to be cached.
- [#7080](https://github.com/thanos-io/thanos/pull/7080) Receive: race condition in handler Close() when stopped early
- [#7132](https://github.com/thanos-io/thanos/pull/7132) Documentation: fix broken helm installation instruction
- [#7134](https://github.com/thanos-io/thanos/pull/7134) Store, Compact: Revert the recursive block listing mechanism introduced in https://github.com/thanos-io/thanos/pull/6474 and use the same strategy as in 0.31. Introduce a `--block-discovery-strategy` flag to control the listing strategy so that a recursive lister can still be used if the tradeoff of slower but cheaper discovery is preferred.
- [#7122](https://github.com/thanos-io/thanos/pull/7122) Store Gateway: Fix lazy expanded postings estimate base cardinality using posting group with remove keys.
- [#7224](https://github.com/thanos-io/thanos/pull/7224) Query-frontend: Add Redis username to the client configuration.
- [#7220](https://github.com/thanos-io/thanos/pull/7220) Store Gateway: Fix lazy expanded postings caching partial expanded postings and bug of estimating remove postings with non existent value. Added `PromQLSmith` based fuzz test to improve correctness.

### Added

- [#7194](https://github.com/thanos-io/thanos/pull/7194) Downsample: retry objstore related errors
- [#7105](https://github.com/thanos-io/thanos/pull/7105) Rule: add flag `--query.enable-x-functions` to allow usage of extended promql functions (xrate, xincrease, xdelta) in loaded rules
- [#6867](https://github.com/thanos-io/thanos/pull/6867) Query UI: Tenant input box added to the Query UI, in order to be able to specify which tenant the query should use.
- [#7175](https://github.com/thanos-io/thanos/pull/7175): Query: Add `--query.mode=distributed` which enables the new distributed mode of the Thanos query engine.
- [#7199](https://github.com/thanos-io/thanos/pull/7199): Reloader: Add support for watching and decompressing Prometheus configuration directories
- [#7200](https://github.com/thanos-io/thanos/pull/7175): Query: Add `--selector.relabel-config` and `--selector.relabel-config-file` flags which allows scoping the Querier to a subset of matched TSDBs.
- [#7233](https://github.com/thanos-io/thanos/pull/7233): UI: Showing Block Size Stats

### Changed

- [#7123](https://github.com/thanos-io/thanos/pull/7123) Rule: Change default Alertmanager API version to v2.
- [#7223](https://github.com/thanos-io/thanos/pull/7223) Automatic detection of memory limits and configure GOMEMLIMIT to match.

### Removed

## [v0.34.1](https://github.com/thanos-io/thanos/tree/release-0.34) - 11.02.24
Expand All @@ -38,6 +57,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
- [#6874](https://github.com/thanos-io/thanos/pull/6874) Sidecar: fix labels returned by 'api/v1/series' in presence of conflicting external and inner labels.
- [#7009](https://github.com/thanos-io/thanos/pull/7009) Rule: Fix spacing error in URL.
- [#7082](https://github.com/thanos-io/thanos/pull/7082) Stores: fix label values edge case when requesting external label values with matchers
- [#7114](https://github.com/thanos-io/thanos/pull/7114) Stores: fix file path bug for minio v7.0.61

### Added

Expand All @@ -53,13 +73,16 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
- [#6887](https://github.com/thanos-io/thanos/pull/6887) Query Frontend: *breaking :warning:* Add tenant label to relevant exported metrics. Note that this change may cause some pre-existing custom dashboard queries to be incorrect due to the added label.
- [#7028](https://github.com/thanos-io/thanos/pull/7028) Query|Query Frontend: Add new `--query-frontend.enable-x-functions` flag to enable experimental extended functions.
- [#6884](https://github.com/thanos-io/thanos/pull/6884) Tools: Add upload-block command to upload blocks to object storage.
- [#7010](https://github.com/thanos-io/thanos/pull/7010) Cache: Added `set_async_circuit_breaker_*` to utilize the circuit breaker pattern for dynamically thresholding asynchronous set operations.

### Changed

- [#6539](https://github.com/thanos-io/thanos/pull/6539) Store: *breaking :warning:* Changed `--sync-block-duration` default 3m to 15m.

### Removed

- [#7014](https://github.com/thanos-io/thanos/pull/7014) *: *breaking :warning:* Removed experimental query pushdown feature to simplify query path. This feature has had high complexity for too little benefits. The responsibility for query pushdown will be moved to the distributed mode of the new 'thanos' promql engine.

## [v0.33.0](https://github.com/thanos-io/thanos/tree/release-0.33) - 18.12.2023

### Fixed
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile.multi-stage
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ COPY . $GOPATH/src/github.com/thanos-io/thanos
RUN git update-index --refresh; make build

# -----------------------------------------------------------------------------
FROM alpine:3.15

#FROM quay.io/prometheus/busybox@sha256:${BASE_DOCKER_SHA}
FROM quay.io/prometheus/busybox@sha256:${BASE_DOCKER_SHA}
LABEL maintainer="The Thanos Authors"

COPY --from=builder /go/bin/thanos /bin/thanos
Expand Down
2 changes: 1 addition & 1 deletion MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
| Bartłomiej Płotka | [email protected] | `@bwplotka` | [@bwplotka](https://github.com/bwplotka) | Google |
| Frederic Branczyk | [email protected] | `@brancz` | [@brancz](https://github.com/brancz) | Polar Signals |
| Giedrius Statkevičius | [email protected] | `@Giedrius Statkevičius` | [@GiedriusS](https://github.com/GiedriusS) | Vinted |
| Kemal Akkoyun | [email protected] | `@kakkoyun` | [@kakkoyun](https://github.com/kakkoyun) | Polar Signals |
| Kemal Akkoyun | [email protected] | `@kakkoyun` | [@kakkoyun](https://github.com/kakkoyun) | Fal |
| Lucas Servén Marín | [email protected] | `@squat` | [@squat](https://github.com/squat) | Red Hat |
| Prem Saraswat | [email protected] | `@Prem Saraswat` | [@onprem](https://github.com/onprem) | Red Hat |
| Matthias Loibl | [email protected] | `@metalmatze` | [@metalmatze](https://github.com/metalmatze) | Polar Signals |
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ $(REACT_APP_OUTPUT_DIR): $(REACT_APP_NODE_MODULES_PATH) $(REACT_APP_SOURCE_FILES
.PHONY: react-app
react-app: $(REACT_APP_OUTPUT_DIR)

.PHONY: check-react-app
check-react-app: react-app
$(call require_clean_work_tree,'all generated files should be committed, run make react-app and commit changes.')

.PHONY: react-app-lint
react-app-lint: $(REACT_APP_NODE_MODULES_PATH)
@echo ">> running React app linting"
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.34.1
0.35.0-dev
16 changes: 14 additions & 2 deletions cmd/thanos/compact.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,16 @@ func runCompact(
consistencyDelayMetaFilter := block.NewConsistencyDelayMetaFilter(logger, conf.consistencyDelay, extprom.WrapRegistererWithPrefix("thanos_", reg))
timePartitionMetaFilter := block.NewTimePartitionMetaFilter(conf.filterConf.MinTime, conf.filterConf.MaxTime)

baseBlockIDsFetcher := block.NewBaseBlockIDsFetcher(logger, insBkt)
baseMetaFetcher, err := block.NewBaseFetcher(logger, conf.blockMetaFetchConcurrency, insBkt, baseBlockIDsFetcher, conf.dataDir, extprom.WrapRegistererWithPrefix("thanos_", reg))
var blockLister block.Lister
switch syncStrategy(conf.blockListStrategy) {
case concurrentDiscovery:
blockLister = block.NewConcurrentLister(logger, insBkt)
case recursiveDiscovery:
blockLister = block.NewRecursiveLister(logger, insBkt)
default:
return errors.Errorf("unknown sync strategy %s", conf.blockListStrategy)
}
baseMetaFetcher, err := block.NewBaseFetcher(logger, conf.blockMetaFetchConcurrency, insBkt, blockLister, conf.dataDir, extprom.WrapRegistererWithPrefix("thanos_", reg))
if err != nil {
return errors.Wrap(err, "create meta fetcher")
}
Expand Down Expand Up @@ -695,6 +703,7 @@ type compactConfig struct {
wait bool
waitInterval time.Duration
disableDownsampling bool
blockListStrategy string
blockMetaFetchConcurrency int
blockFilesConcurrency int
blockViewerSyncBlockInterval time.Duration
Expand Down Expand Up @@ -757,6 +766,9 @@ func (cc *compactConfig) registerFlag(cmd extkingpin.FlagClause) {
"as querying long time ranges without non-downsampled data is not efficient and useful e.g it is not possible to render all samples for a human eye anyway").
Default("false").BoolVar(&cc.disableDownsampling)

strategies := strings.Join([]string{string(concurrentDiscovery), string(recursiveDiscovery)}, ", ")
cmd.Flag("block-discovery-strategy", "One of "+strategies+". When set to concurrent, stores will concurrently issue one call per directory to discover active blocks in the bucket. The recursive strategy iterates through all objects in the bucket, recursively traversing into each directory. This avoids N+1 calls at the expense of having slower bucket iterations.").
Default(string(concurrentDiscovery)).StringVar(&cc.blockListStrategy)
cmd.Flag("block-meta-fetch-concurrency", "Number of goroutines to use when fetching block metadata from object storage.").
Default("32").IntVar(&cc.blockMetaFetchConcurrency)
cmd.Flag("block-files-concurrency", "Number of goroutines to use when fetching/uploading block files from object storage.").
Expand Down
40 changes: 40 additions & 0 deletions cmd/thanos/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"strings"
"time"

"github.com/KimMachineGun/automemlimit/memlimit"
extflag "github.com/efficientgo/tools/extkingpin"
"github.com/pkg/errors"

Expand Down Expand Up @@ -283,3 +284,42 @@ func parseFlagLabels(s []string) (labels.Labels, error) {
sort.Sort(lset)
return lset, nil
}

type goMemLimitConfig struct {
enableAutoGoMemlimit bool
memlimitRatio float64
}

func (gml *goMemLimitConfig) registerFlag(cmd extkingpin.FlagClause) *goMemLimitConfig {
cmd.Flag("enable-auto-gomemlimit",
"Enable go runtime to automatically limit memory consumption.").
Default("false").BoolVar(&gml.enableAutoGoMemlimit)

cmd.Flag("auto-gomemlimit.ratio",
"The ratio of reserved GOMEMLIMIT memory to the detected maximum container or system memory.").
Default("0.9").FloatVar(&gml.memlimitRatio)

return gml
}

func configureGoAutoMemLimit(common goMemLimitConfig) error {
if common.memlimitRatio <= 0.0 || common.memlimitRatio > 1.0 {
return errors.New("--auto-gomemlimit.ratio must be greater than 0 and less than or equal to 1.")
}

if common.enableAutoGoMemlimit {
if _, err := memlimit.SetGoMemLimitWithOpts(
memlimit.WithRatio(common.memlimitRatio),
memlimit.WithProvider(
memlimit.ApplyFallback(
memlimit.FromCgroup,
memlimit.FromSystem,
),
),
); err != nil {
return errors.Wrap(err, "Failed to set GOMEMLIMIT automatically")
}
}

return nil
}
7 changes: 4 additions & 3 deletions cmd/thanos/downsample.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/prometheus/tsdb"
"github.com/prometheus/prometheus/tsdb/chunkenc"
"github.com/thanos-io/thanos/pkg/compact"

"github.com/thanos-io/objstore"
"github.com/thanos-io/objstore/client"
Expand Down Expand Up @@ -90,7 +91,7 @@ func RunDownsample(
insBkt := objstoretracing.WrapWithTraces(objstore.WrapWithMetrics(bkt, extprom.WrapRegistererWithPrefix("thanos_", reg), bkt.Name()))

// While fetching blocks, filter out blocks that were marked for no downsample.
baseBlockIDsFetcher := block.NewBaseBlockIDsFetcher(logger, insBkt)
baseBlockIDsFetcher := block.NewConcurrentLister(logger, insBkt)
metaFetcher, err := block.NewMetaFetcher(logger, block.FetcherConcurrency, insBkt, baseBlockIDsFetcher, "", extprom.WrapRegistererWithPrefix("thanos_", reg), []block.MetadataFilter{
block.NewDeduplicateFilter(block.FetcherConcurrency),
downsample.NewGatherNoDownsampleMarkFilter(logger, insBkt, block.FetcherConcurrency),
Expand Down Expand Up @@ -358,7 +359,7 @@ func processDownsampling(

err := block.Download(ctx, logger, bkt, m.ULID, bdir, objstore.WithFetchConcurrency(blockFilesConcurrency))
if err != nil {
return errors.Wrapf(err, "download block %s", m.ULID)
return compact.NewRetryError(errors.Wrapf(err, "download block %s", m.ULID))
}
level.Info(logger).Log("msg", "downloaded block", "id", m.ULID, "duration", time.Since(begin), "duration_ms", time.Since(begin).Milliseconds())

Expand Down Expand Up @@ -419,7 +420,7 @@ func processDownsampling(

err = block.Upload(ctx, logger, bkt, resdir, hashFunc)
if err != nil {
return errors.Wrapf(err, "upload downsampled block %s", id)
return compact.NewRetryError(errors.Wrapf(err, "upload downsampled block %s", id))
}

level.Info(logger).Log("msg", "uploaded block", "id", id, "duration", time.Since(begin), "duration_ms", time.Since(begin).Milliseconds())
Expand Down
12 changes: 11 additions & 1 deletion cmd/thanos/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
versioncollector "github.com/prometheus/client_golang/prometheus/collectors/version"
"github.com/prometheus/common/version"
"go.uber.org/automaxprocs/maxprocs"
"gopkg.in/alecthomas/kingpin.v2"
Expand Down Expand Up @@ -49,6 +50,10 @@ func main() {
Default(logging.LogFormatLogfmt).Enum(logging.LogFormatLogfmt, logging.LogFormatJSON)
tracingConfig := extkingpin.RegisterCommonTracingFlags(app)

goMemLimitConf := goMemLimitConfig{}

goMemLimitConf.registerFlag(app)

registerSidecar(app)
registerStore(app)
registerQuery(app)
Expand All @@ -61,6 +66,11 @@ func main() {
cmd, setup := app.Parse()
logger := logging.NewLogger(*logLevel, *logFormat, *debugName)

if err := configureGoAutoMemLimit(goMemLimitConf); err != nil {
level.Error(logger).Log("msg", "failed to configure Go runtime memory limits", "err", err)
os.Exit(1)
}

// Running in container with limits but with empty/wrong value of GOMAXPROCS env var could lead to throttling by cpu
// maxprocs will automate adjustment by using cgroups info about cpu limit if it set as value for runtime.GOMAXPROCS.
undo, err := maxprocs.Set(maxprocs.Logger(func(template string, args ...interface{}) {
Expand All @@ -73,7 +83,7 @@ func main() {

metrics := prometheus.NewRegistry()
metrics.MustRegister(
version.NewCollector("thanos"),
versioncollector.NewCollector("thanos"),
collectors.NewGoCollector(
collectors.WithGoCollectorRuntimeMetrics(collectors.GoRuntimeMetricsRule{Matcher: regexp.MustCompile("/.*")}),
),
Expand Down
5 changes: 3 additions & 2 deletions cmd/thanos/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/thanos-io/objstore"

"github.com/efficientgo/core/testutil"

"github.com/thanos-io/thanos/pkg/block"
"github.com/thanos-io/thanos/pkg/block/metadata"
"github.com/thanos-io/thanos/pkg/compact/downsample"
Expand Down Expand Up @@ -157,7 +158,7 @@ func TestRegression4960_Deadlock(t *testing.T) {

metrics := newDownsampleMetrics(prometheus.NewRegistry())
testutil.Equals(t, 0.0, promtest.ToFloat64(metrics.downsamples.WithLabelValues(meta.Thanos.GroupKey())))
baseBlockIDsFetcher := block.NewBaseBlockIDsFetcher(logger, bkt)
baseBlockIDsFetcher := block.NewConcurrentLister(logger, bkt)
metaFetcher, err := block.NewMetaFetcher(nil, block.FetcherConcurrency, bkt, baseBlockIDsFetcher, "", nil, nil)
testutil.Ok(t, err)

Expand Down Expand Up @@ -197,7 +198,7 @@ func TestCleanupDownsampleCacheFolder(t *testing.T) {

metrics := newDownsampleMetrics(prometheus.NewRegistry())
testutil.Equals(t, 0.0, promtest.ToFloat64(metrics.downsamples.WithLabelValues(meta.Thanos.GroupKey())))
baseBlockIDsFetcher := block.NewBaseBlockIDsFetcher(logger, bkt)
baseBlockIDsFetcher := block.NewConcurrentLister(logger, bkt)
metaFetcher, err := block.NewMetaFetcher(nil, block.FetcherConcurrency, bkt, baseBlockIDsFetcher, "", nil, nil)
testutil.Ok(t, err)

Expand Down
Loading
Loading