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

chore: Vendor Cortex dependency as an internal package #5504

Merged
merged 4 commits into from
Jul 15, 2022
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
71 changes: 71 additions & 0 deletions .cortex-packages.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
+ chunk
+ chunk/*.go
+ chunk/cache
+ chunk/encoding
+ chunk/purger
+ chunk/purger.test
+ chunk/testutils
- chunk/*
+ cortexpb
+ frontend
+ ingester
+ ingester/client
- ingester/*
+ prom1
+ prom1/storage
+ prom1/storage/metric
- prom1/storage/*
- prom1/*
+ querier
+ querier/*.go
+ querier/astmapper
+ querier/batch
+ querier/chunkstore
+ querier/iterators
+ querier/lazyquery
+ querier/queryrange
+ querier/series
+ querier/stats
+ querier/worker
+ querier.test
- querier/*
+ ring
+ ring/*.go
+ ring/client
+ ring/kv
+ ring/shard
+ ring/util
- ring/*
+ scheduler
+ storage
+ storage/bucket
+ storage/tsdb
- storage/*
+ storegateway
+ tenant
+ util
+ util/*.go
+ util/backoff
+ util/chunkcompat
+ util/concurrency
+ util/extract
+ util/flagext
+ util/grpcclient
+ util/grpcencoding
+ util/grpcencoding/snappy
+ util/grpcutil
+ util/httpgrpcutil
+ util/limiter
+ util/log
+ util/math
+ util/middleware
+ util/multierror
+ util/runutil
+ util/services
+ util/spanlogger
+ util/test
+ util/tls
+ util/validation
- util/grpcencoding/*
- util/*
- /*
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
internal/cortex/ linguist-vendored
2 changes: 2 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
paths-ignore:
- 'internal/cortex/**/*.go'
1 change: 1 addition & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
Expand Down
5 changes: 4 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ run:
# default value is empty list, but next dirs are always skipped independently
# from this option's value:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs: vendor
skip-dirs:
- vendor
- internal/cortex


# output configuration options
output:
Expand Down
33 changes: 26 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include .bingo/Variables.mk
include .busybox-versions

FILES_TO_FMT ?= $(shell find . -path ./vendor -prune -o -name '*.go' -print)
FILES_TO_FMT ?= $(shell find . -path ./vendor -prune -o -path ./internal/cortex -prune -o -name '*.go' -print)
MD_FILES_TO_FORMAT = $(shell find docs -name "*.md") $(shell find examples -name "*.md") $(filter-out mixin/runbook.md, $(shell find mixin -name "*.md")) $(shell ls *.md)
FAST_MD_FILES_TO_FORMAT = $(shell git diff --name-only | grep ".md")

Expand Down Expand Up @@ -173,6 +173,25 @@ deps: ## Ensures fresh go.mod and go.sum.
@go mod tidy
@go mod verify

# NOTICE: This is a temporary workaround for the cyclic dependency issue documented in:
# https://github.com/thanos-io/thanos/issues/3832
# The real solution is to have our own version of needed packages, or extract them out from a dedicated module.
# vendor dependencies
.PHONY: internal/cortex
internal/cortex: ## Ensures the latest packages from 'cortex' are synced.
rm -rf internal/cortex
rm -rf tmp/cortex
git clone --depth 1 https://github.com/cortexproject/cortex tmp/cortex
mkdir -p internal/cortex
rsync -avur --delete tmp/cortex/pkg/* internal/cortex --include-from=.cortex-packages.txt
mkdir -p internal/cortex/integration
cp -R tmp/cortex/integration/ca internal/cortex/integration/ca
find internal/cortex -type f -exec sed -i 's/github.com\/cortexproject\/cortex\/pkg/github.com\/thanos-io\/thanos\/internal\/cortex/g' {} +
find internal/cortex -type f -exec sed -i 's/github.com\/cortexproject\/cortex\/integration/github.com\/thanos-io\/thanos\/internal\/cortex\/integration/g' {} +
rm -rf tmp/cortex
@echo ">> ensuring Copyright headers"
@go run ./scripts/copyright

.PHONY: docker
docker: ## Builds 'thanos' docker with no tag.
ifeq ($(OS)_$(ARCH), linux_x86_64)
Expand Down Expand Up @@ -286,7 +305,7 @@ test: export GOCACHE= $(TMP_GOPATH)/gocache
test: export THANOS_TEST_MINIO_PATH= $(MINIO)
test: export THANOS_TEST_PROMETHEUS_PATHS= $(PROMETHEUS_ARRAY)
test: export THANOS_TEST_ALERTMANAGER_PATH= $(ALERTMANAGER)
test: check-git install-deps
test: check-git install-tool-deps
@echo ">> install thanos GOOPTS=${GOOPTS}"
@echo ">> running unit tests (without /test/e2e). Do export THANOS_TEST_OBJSTORE_SKIP=GCS,S3,AZURE,SWIFT,COS,ALIYUNOSS,BOS if you want to skip e2e tests against all real store buckets. Current value: ${THANOS_TEST_OBJSTORE_SKIP}"
@go test $(shell go list ./... | grep -v /vendor/ | grep -v /test/e2e);
Expand Down Expand Up @@ -317,13 +336,13 @@ test-e2e-local:

.PHONY: quickstart
quickstart: ## Installs and runs a quickstart example of thanos.
quickstart: build install-deps
quickstart: build install-tool-deps
quickstart:
scripts/quickstart.sh

.PHONY: install-deps
install-deps: ## Installs dependencies for integration tests. It installs supported versions of Prometheus and alertmanager to test against in integration tests.
install-deps: $(ALERTMANAGER) $(MINIO) $(PROMETHEUS_ARRAY)
.PHONY: install-tool-deps
install-tool-deps: ## Installs dependencies for integration tests. It installs supported versions of Prometheus and alertmanager to test against in integration tests.
install-tool-deps: $(ALERTMANAGER) $(MINIO) $(PROMETHEUS_ARRAY)
@echo ">>GOBIN=$(GOBIN)"

.PHONY: check-git
Expand Down Expand Up @@ -376,7 +395,7 @@ github.com/prometheus/client_golang/prometheus.{DefaultGatherer,DefBuckets,NewUn
github.com/prometheus/client_golang/prometheus.{NewCounter,NewCounterVec,NewCounterVec,NewGauge,NewGaugeVec,NewGaugeFunc,\
NewHistorgram,NewHistogramVec,NewSummary,NewSummaryVec}=github.com/prometheus/client_golang/prometheus/promauto.{NewCounter,\
NewCounterVec,NewCounterVec,NewGauge,NewGaugeVec,NewGaugeFunc,NewHistorgram,NewHistogramVec,NewSummary,NewSummaryVec},\
sync/atomic=go.uber.org/atomic" ./...
sync/atomic=go.uber.org/atomic,github.com/cortexproject/cortex=github.com/thanos-io/thanos/internal/cortex" $(shell go list ./... | grep -v "internal/cortex")
@$(FAILLINT) -paths "fmt.{Print,Println,Sprint}" -ignore-tests ./...
@echo ">> linting all of the Go files GOGC=${GOGC}"
@$(GOLANGCI_LINT) run
Expand Down
11 changes: 5 additions & 6 deletions cmd/thanos/query_frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ import (
"time"

"github.com/NYTimes/gziphandler"
cortexfrontend "github.com/cortexproject/cortex/pkg/frontend"
"github.com/cortexproject/cortex/pkg/frontend/transport"
"github.com/cortexproject/cortex/pkg/querier/queryrange"
cortexvalidation "github.com/cortexproject/cortex/pkg/util/validation"
extflag "github.com/efficientgo/tools/extkingpin"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/oklog/run"
Expand All @@ -22,8 +19,10 @@ import (
"github.com/weaveworks/common/user"
"gopkg.in/yaml.v2"

extflag "github.com/efficientgo/tools/extkingpin"

cortexfrontend "github.com/thanos-io/thanos/internal/cortex/frontend"
"github.com/thanos-io/thanos/internal/cortex/frontend/transport"
"github.com/thanos-io/thanos/internal/cortex/querier/queryrange"
cortexvalidation "github.com/thanos-io/thanos/internal/cortex/util/validation"
"github.com/thanos-io/thanos/pkg/api"
"github.com/thanos-io/thanos/pkg/component"
"github.com/thanos-io/thanos/pkg/extkingpin"
Expand Down
50 changes: 27 additions & 23 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ require (
github.com/cespare/xxhash/v2 v2.1.2
github.com/chromedp/cdproto v0.0.0-20200424080200-0de008e41fa0
github.com/chromedp/chromedp v0.5.3
github.com/cortexproject/cortex v1.12.0-rc.0.0.20220711221148-77a7e11cc893
github.com/davecgh/go-spew v1.1.1
github.com/efficientgo/e2e v0.12.1
github.com/efficientgo/tools/core v0.0.0-20210829154005-c7bad8450208
Expand All @@ -40,7 +39,7 @@ require (
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
github.com/golang/snappy v0.0.4
github.com/googleapis/gax-go v2.0.2+incompatible
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/grpc-ecosystem/go-grpc-middleware/providers/kit/v2 v2.0.0-20201002093600-73cf2ae9d891
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.2.0.20201207153454-9f6bf00c00a7
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
Expand Down Expand Up @@ -97,7 +96,26 @@ require (
gopkg.in/yaml.v3 v3.0.1
)

require github.com/stretchr/testify v1.7.2
require (
github.com/armon/go-metrics v0.3.9
github.com/dustin/go-humanize v1.0.0
github.com/golang/protobuf v1.5.2
github.com/gorilla/mux v1.8.0
github.com/grafana/regexp v0.0.0-20220304095617-2e8d9baf4ac2
github.com/hashicorp/consul/api v1.13.0
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/go-sockaddr v1.0.2
github.com/hashicorp/memberlist v0.3.1
github.com/json-iterator/go v1.1.12
github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e
github.com/opentracing-contrib/go-stdlib v1.0.0
github.com/sony/gobreaker v0.4.1
github.com/stretchr/testify v1.7.1
go.etcd.io/etcd/api/v3 v3.5.4
go.etcd.io/etcd/client/pkg/v3 v3.5.4
go.etcd.io/etcd/client/v3 v3.5.4
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65
)

require (
cloud.google.com/go v0.100.2 // indirect
Expand All @@ -109,9 +127,9 @@ require (
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/OneOfOne/xxhash v1.2.6 // indirect
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a // indirect
github.com/armon/go-metrics v0.3.9 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
github.com/aws/aws-sdk-go v1.44.29 // indirect
Expand All @@ -124,13 +142,13 @@ require (
github.com/aws/aws-sdk-go-v2/service/sso v1.9.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.14.0 // indirect
github.com/aws/smithy-go v1.10.0 // indirect
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/dennwc/varint v1.0.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/edsrzf/mmap-go v1.1.0 // indirect
github.com/elastic/go-sysinfo v1.1.1 // indirect
github.com/elastic/go-windows v1.0.1 // indirect
Expand All @@ -153,30 +171,22 @@ require (
github.com/gobwas/ws v1.0.2 // indirect
github.com/gogo/googleapis v1.4.0 // indirect
github.com/golang-jwt/jwt/v4 v4.4.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/pprof v0.0.0-20220608213341-c488b8fa1db3 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/gax-go/v2 v2.4.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/grafana/regexp v0.0.0-20220304095617-2e8d9baf4ac2 // indirect
github.com/hashicorp/consul/api v1.13.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-hclog v0.16.2 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-msgpack v0.5.5 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
github.com/hashicorp/memberlist v0.3.1 // indirect
github.com/hashicorp/serf v0.9.6 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/julienschmidt/httprouter v1.3.0 // indirect
github.com/klauspost/cpuid/v2 v2.0.14 // indirect
github.com/knq/sysutil v0.0.0-20191005231841-15668db23d08 // indirect
Expand All @@ -194,26 +204,22 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mozillazg/go-httpheader v0.2.1 // indirect
github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e // indirect
github.com/opentracing-contrib/go-stdlib v1.0.0 // indirect
github.com/prometheus/common/sigv4 v0.1.0 // indirect
github.com/prometheus/node_exporter v1.0.0-rc.0.0.20200428091818-01054558c289 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rs/xid v1.4.0 // indirect
github.com/santhosh-tekuri/jsonschema v1.2.4 // indirect
github.com/satori/go.uuid v1.2.0 // indirect
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect
github.com/sercand/kuberesolver v2.4.0+incompatible // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/sony/gobreaker v0.4.1 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/stretchr/objx v0.2.0 // indirect
github.com/weaveworks/promrus v1.2.0 // indirect
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da // indirect
go.elastic.co/apm/module/apmhttp v1.11.0 // indirect
go.elastic.co/fastjson v1.1.0 // indirect
go.etcd.io/etcd/api/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/v3 v3.5.4 // indirect
go.mongodb.org/mongo-driver v1.8.4 // indirect
go.opencensus.io v0.23.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.32.0 // indirect
Expand All @@ -222,7 +228,6 @@ require (
go.uber.org/zap v1.21.0 // indirect
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
golang.org/x/tools v0.1.10 // indirect
golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand All @@ -236,7 +241,6 @@ replace (
// Required by Cortex https://github.com/cortexproject/cortex/pull/3051.
github.com/bradfitz/gomemcache => github.com/themihai/gomemcache v0.0.0-20180902122335-24332e2d58ab

github.com/efficientgo/tools/core => github.com/efficientgo/tools/core v0.0.0-20210731122119-5d4a0645ce9a
// Update to v1.1.1 to make sure windows CI pass.
github.com/elastic/go-sysinfo => github.com/elastic/go-sysinfo v1.1.1

Expand All @@ -251,7 +255,7 @@ replace (
github.com/vimeo/galaxycache => github.com/thanos-community/galaxycache v0.0.0-20211122094458-3a32041a1f1e
google.golang.org/grpc => google.golang.org/grpc v1.40.1

// Overriding to use latest commit
// Overriding to use latest commit.
gopkg.in/alecthomas/kingpin.v2 => github.com/alecthomas/kingpin v1.3.8-0.20210301060133-17f40c25f497

// From Prometheus.
Expand Down
Loading