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

Remove dependencies on thanos-io/thanos #3288

Merged
merged 41 commits into from
Nov 3, 2022
Merged

Remove dependencies on thanos-io/thanos #3288

merged 41 commits into from
Nov 3, 2022

Conversation

bboreham
Copy link
Contributor

@bboreham bboreham commented Oct 22, 2022

What this PR does

Remove all dependencies on upstream project thanos-io/thanos, either by forking the necessary code into Mimir or by adding to upstream project dskit.

This makes it easier to adopt changes, for instance from Prometheus, that otherwise require synchronisation, local forks of Thanos, etc.

The PR is split into a number of commits which go package by package, to make it easier to follow the changes.

Builds on #2682 and #3222; needs upstream change grafana/dskit#228.

Notes

  • The function setupThanosTracing has been temporarily removed; as far as I can see the required hook is absent from thanos-io/objstore and have reported a bug there.
  • I excluded shipper_e2e_test.go and its associated test utils; this brought in large amounts of new dependencies via thanos/objstore to use different cloud providers that Mimir does not currently support.

Some packages already had some indirection in Mimir, and would benefit from further rationalisation:

  • cache
  • pool

Checklist

  • Tests updated
  • NA Documentation added
  • NA CHANGELOG.md updated - not a user-visible change.

Copy link
Collaborator

@pracucci pracucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Massive work! LGTM! I just have a couple of comments I would be glad you to look at before merging:

  • Could you also doing the package import replace in the new tools/copyblocks/main.go?
  • Could you update the lint Makefile target, removing all Thanos faillint rules and adding a single rule like `faillint -paths "github.com/thanos-io/thanos/pkg" ./pkg/... ./cmd/... ./tools/... ./integration/...

pkg/cache/memcache_config.go Outdated Show resolved Hide resolved
pkg/shipper/shipper_test.go Outdated Show resolved Hide resolved
pkg/util/extprom/extprom.go Outdated Show resolved Hide resolved
@pracucci
Copy link
Collaborator

I also want to take a look at the tracing thing, cause looks like an issue we already have in main. If so, not a blocker for this PR, but we need to fix it asap.

pkg/mimir/tracing.go Outdated Show resolved Hide resolved
Part of breaking Mimir dependency on Thanos
Part of breaking Mimir dependency on Thanos
Part of breaking Mimir dependency on Thanos.

Needs a couple of extra metadata consts.
Part of breaking Mimir dependency on Thanos
Part of breaking Mimir dependency on Thanos
Part of breaking Mimir dependency on Thanos
bytes and dns packages are copied from Thanos; also the `DeleteAll`
function in package runutil.

Part of breaking Mimir dependency on Thanos.
Part of breaking Mimir dependency on Thanos.
Part of breaking Mimir dependency on Thanos.
Part of breaking Mimir dependency on Thanos
Part of breaking Mimir dependency on Thanos
Add a `New()` function in `gate` package to simplify calling.

Part of breaking Mimir dependency on Thanos.
Part of breaking Mimir dependency on Thanos.
Note there is no way to set up the tracing context now, hence tracing
from the objstore package probably doesn't work.

Part of breaking Mimir dependency on thanos-io/thanos
Part of breaking Mimir dependency on thanos-io/thanos.
Part of breaking Mimir dependency on Thanos.
Comments say never to call it.
Part of breaking Mimir dependency on Thanos.
Part of breaking Mimir dependency on Thanos.
Part of breaking Mimir dependency on Thanos.
Part of breaking Mimir dependency on Thanos.
Missed from original port.

Part of breaking Mimir dependency on Thanos.
Note the previous rule had a typo.

Part of breaking Mimir dependency on Thanos.
Prometheus client_go upstream has had this behaviour built in for 2 years.

Part of breaking Mimir dependency on Thanos.
Should be less confusing in future.

Part of breaking Mimir dependency on Thanos.
For consistency, and to reduce dependencies.
@bboreham
Copy link
Contributor Author

bboreham commented Oct 27, 2022

Believe I have done everything you suggested.
Note this depends on upstream change grafana/dskit#228, so we should merge that first and update the dskit dependency back to main.
UPDATE: dskit dependency now merged and updated.

Missed from earlier import. Needs a couple of changes elsewhere.

Some tests removed, either because they test code that was not brought
into Mimir, or because they add dependencies on multiple cloud SDKs.
For consistency, and to reduce dependencies.
Instead of the PR branch.
Copy link
Collaborator

@pracucci pracucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late review, LGTM! 🚀

@pracucci pracucci merged commit ef1a5bf into main Nov 3, 2022
@pracucci pracucci deleted the no-thanos branch November 3, 2022 10:14
masonmei pushed a commit to udmire/mimir that referenced this pull request Nov 4, 2022
* Fork Thanos metadata package

Part of breaking Mimir dependency on Thanos

* Use Mimir copy of metadata package

Part of breaking Mimir dependency on Thanos

* Fix typo mimit->mimir

* Fork Thanos block package

Part of breaking Mimir dependency on Thanos.

Needs a couple of extra metadata consts.

* Use Mimir copy of block package

Part of breaking Mimir dependency on Thanos

* Remove unused code from block package

* Fork Thanos extprom package

Part of breaking Mimir dependency on Thanos

* Use Mimir copy of extprom package

Part of breaking Mimir dependency on Thanos

* Import dskit with bytes and dns packages

bytes and dns packages are copied from Thanos; also the `DeleteAll`
function in package runutil.

Part of breaking Mimir dependency on Thanos.

* Use dskit/runutil instead of thanos/pkg/runutil

Part of breaking Mimir dependency on Thanos.

* Use MultiError from dskit instead of Thanos

Part of breaking Mimir dependency on Thanos.

* Simplify test values in bucket e2e test

* Fork Thanos cache package

Part of breaking Mimir dependency on Thanos

* Fork Thanos cacheutil package

Part of breaking Mimir dependency on Thanos

* Make cacheutil package use local packages

Add a `New()` function in `gate` package to simplify calling.

Part of breaking Mimir dependency on Thanos.

* Use Mimir fork of cacheutil package

Part of breaking Mimir dependency on Thanos.

* Use thanos-io/objstore/tracing

Note there is no way to set up the tracing context now, hence tracing
from the objstore package probably doesn't work.

Part of breaking Mimir dependency on thanos-io/thanos

* Use Bytes type from dskit/flagext

Part of breaking Mimir dependency on thanos-io/thanos.

* Fork Thanos strutil package

Part of breaking Mimir dependency on Thanos.

* Add a test for util.MergeSlices

* Stop calling strings.Compare

Comments say never to call it.

* Use Mimir version of MergeSlices

Part of breaking Mimir dependency on Thanos.

* Use dns package from dnskit instead of Thanos

Part of breaking Mimir dependency on Thanos.

* Remove unused Memcached AutoDiscovery

Part of breaking Mimir dependency on Thanos.

* Fork Thanos pool package

Part of breaking Mimir dependency on Thanos.

* Use Mimir copy of pool package

Part of breaking Mimir dependency on Thanos.

* Fork Thanos shipper package

Did not include shipper_e2e_test.go, because it drags in dependencies on
lots of new cloud providers.

Part of breaking Mimir dependency on Thanos.

* Use Mimir copy of shipper package

Part of breaking Mimir dependency on Thanos.

* go mod tidy, update vendor

* Use Mimir copy of packages in copyblocks tool

Missed from original port.

Part of breaking Mimir dependency on Thanos.

* Check that thanos-io/thanos is not used as import

Note the previous rule had a typo.

Part of breaking Mimir dependency on Thanos.

* go mod tidy, update vendor

* Update thanos-io/thanos for tracing fix

* Re-add tracing for thanos-io/objstore

* Remove unnecessary extprom.WrapRegistererWith

Prometheus client_go upstream has had this behaviour built in for 2 years.

Part of breaking Mimir dependency on Thanos.

* Rename model.Bytes to flagext.Bytes

Should be less confusing in future.

Part of breaking Mimir dependency on Thanos.

* Fix lint warnings from thanos code

* Use testify instead of Thanos testutil

For consistency, and to reduce dependencies.

* Bring in tests for Thanos block package

Missed from earlier import. Needs a couple of changes elsewhere.

Some tests removed, either because they test code that was not brought
into Mimir, or because they add dependencies on multiple cloud SDKs.

* tsdb/block: use testify instead of Thanos testutil

For consistency, and to reduce dependencies.

* Update grafana/dskit to main branch

Instead of the PR branch.
masonmei pushed a commit to udmire/mimir that referenced this pull request Nov 4, 2022
* Fork Thanos metadata package

Part of breaking Mimir dependency on Thanos

* Use Mimir copy of metadata package

Part of breaking Mimir dependency on Thanos

* Fix typo mimit->mimir

* Fork Thanos block package

Part of breaking Mimir dependency on Thanos.

Needs a couple of extra metadata consts.

* Use Mimir copy of block package

Part of breaking Mimir dependency on Thanos

* Remove unused code from block package

* Fork Thanos extprom package

Part of breaking Mimir dependency on Thanos

* Use Mimir copy of extprom package

Part of breaking Mimir dependency on Thanos

* Import dskit with bytes and dns packages

bytes and dns packages are copied from Thanos; also the `DeleteAll`
function in package runutil.

Part of breaking Mimir dependency on Thanos.

* Use dskit/runutil instead of thanos/pkg/runutil

Part of breaking Mimir dependency on Thanos.

* Use MultiError from dskit instead of Thanos

Part of breaking Mimir dependency on Thanos.

* Simplify test values in bucket e2e test

* Fork Thanos cache package

Part of breaking Mimir dependency on Thanos

* Fork Thanos cacheutil package

Part of breaking Mimir dependency on Thanos

* Make cacheutil package use local packages

Add a `New()` function in `gate` package to simplify calling.

Part of breaking Mimir dependency on Thanos.

* Use Mimir fork of cacheutil package

Part of breaking Mimir dependency on Thanos.

* Use thanos-io/objstore/tracing

Note there is no way to set up the tracing context now, hence tracing
from the objstore package probably doesn't work.

Part of breaking Mimir dependency on thanos-io/thanos

* Use Bytes type from dskit/flagext

Part of breaking Mimir dependency on thanos-io/thanos.

* Fork Thanos strutil package

Part of breaking Mimir dependency on Thanos.

* Add a test for util.MergeSlices

* Stop calling strings.Compare

Comments say never to call it.

* Use Mimir version of MergeSlices

Part of breaking Mimir dependency on Thanos.

* Use dns package from dnskit instead of Thanos

Part of breaking Mimir dependency on Thanos.

* Remove unused Memcached AutoDiscovery

Part of breaking Mimir dependency on Thanos.

* Fork Thanos pool package

Part of breaking Mimir dependency on Thanos.

* Use Mimir copy of pool package

Part of breaking Mimir dependency on Thanos.

* Fork Thanos shipper package

Did not include shipper_e2e_test.go, because it drags in dependencies on
lots of new cloud providers.

Part of breaking Mimir dependency on Thanos.

* Use Mimir copy of shipper package

Part of breaking Mimir dependency on Thanos.

* go mod tidy, update vendor

* Use Mimir copy of packages in copyblocks tool

Missed from original port.

Part of breaking Mimir dependency on Thanos.

* Check that thanos-io/thanos is not used as import

Note the previous rule had a typo.

Part of breaking Mimir dependency on Thanos.

* go mod tidy, update vendor

* Update thanos-io/thanos for tracing fix

* Re-add tracing for thanos-io/objstore

* Remove unnecessary extprom.WrapRegistererWith

Prometheus client_go upstream has had this behaviour built in for 2 years.

Part of breaking Mimir dependency on Thanos.

* Rename model.Bytes to flagext.Bytes

Should be less confusing in future.

Part of breaking Mimir dependency on Thanos.

* Fix lint warnings from thanos code

* Use testify instead of Thanos testutil

For consistency, and to reduce dependencies.

* Bring in tests for Thanos block package

Missed from earlier import. Needs a couple of changes elsewhere.

Some tests removed, either because they test code that was not brought
into Mimir, or because they add dependencies on multiple cloud SDKs.

* tsdb/block: use testify instead of Thanos testutil

For consistency, and to reduce dependencies.

* Update grafana/dskit to main branch

Instead of the PR branch.
wilfriedroset added a commit to wilfriedroset/mimir that referenced this pull request Dec 22, 2022
…t PUT on s3-compatible Object Storage.

The grafana#3288 introduce `thanos-io/objstore` instead of `thanos-io/thanos`
and brings along `github.com/minio/minio-go/v7 v7.0.37`. This version
contains a bug who breaks the Multipart PUT on s3-compatible Object
Storage (like the one at OVHcloud, Scaleway and Cloudflare).

The error can be seen in the log as such:
```
upload chunks: upload file /data/mimir/tsdb/[redacted].mimir-continuous-test-100.eu/01GMV0ZR7740VNFM63DVMTQ25W/chunks/000001 as 01GMV0ZR7740VNFM63DVMTQ25W/chunks/000001: upload s3 object: The XML you provided was not well-formed or did not validate against our published schema
```

Related issues:
* thanos-io/thanos#5857
* minio/minio-go#1702

Signed-off-by: Wilfried Roset <wilfriedroset@users.noreply.github.com>
pracucci pushed a commit that referenced this pull request Dec 22, 2022
…t PUT on s3-compatible Object Storage. (#3802)

The #3288 introduce `thanos-io/objstore` instead of `thanos-io/thanos`
and brings along `github.com/minio/minio-go/v7 v7.0.37`. This version
contains a bug who breaks the Multipart PUT on s3-compatible Object
Storage (like the one at OVHcloud, Scaleway and Cloudflare).

The error can be seen in the log as such:
```
upload chunks: upload file /data/mimir/tsdb/[redacted].mimir-continuous-test-100.eu/01GMV0ZR7740VNFM63DVMTQ25W/chunks/000001 as 01GMV0ZR7740VNFM63DVMTQ25W/chunks/000001: upload s3 object: The XML you provided was not well-formed or did not validate against our published schema
```

Related issues:
* thanos-io/thanos#5857
* minio/minio-go#1702

Signed-off-by: Wilfried Roset <wilfriedroset@users.noreply.github.com>

Signed-off-by: Wilfried Roset <wilfriedroset@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants