Skip to content

Commit 6243e4d

Browse files
committed
sidecar: Added support for streaming, chunked remote read.
Fixes: #488 Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
1 parent ab4fdc9 commit 6243e4d

File tree

30 files changed

+778
-2942
lines changed

30 files changed

+778
-2942
lines changed

.circleci/config.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,10 @@ jobs:
3838
# TODO(bplotka): Setup some S3 tests for CI.
3939
command: |
4040
if [ -z ${GCP_PROJECT} ]; then
41-
export THANOS_SKIP_GCS_TESTS="true"
42-
echo "Skipping GCS tests."
41+
make test-local
42+
exit
4343
fi
44-
export THANOS_SKIP_S3_AWS_TESTS="true"
45-
echo "Skipping AWS tests."
46-
export THANOS_SKIP_AZURE_TESTS="true"
47-
echo "Skipping Azure tests."
48-
export THANOS_SKIP_SWIFT_TESTS="true"
49-
echo "Skipping SWIFT tests."
50-
export THANOS_SKIP_TENCENT_COS_TESTS="true"
51-
echo "Skipping TENCENT COS tests."
52-
53-
make test
44+
make test-only-gcs
5445
5546
# Cross build is needed for publish_release but needs to be done outside of docker.
5647
cross_build:

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ tarballs-release: $(PROMU)
178178
.PHONY: test
179179
test: check-git test-deps
180180
@echo ">> running all tests. Do export THANOS_SKIP_GCS_TESTS='true' or/and THANOS_SKIP_S3_AWS_TESTS='true' or/and THANOS_SKIP_AZURE_TESTS='true' and/or THANOS_SKIP_SWIFT_TESTS='true' and/or THANOS_SKIP_TENCENT_COS_TESTS='true' if you want to skip e2e tests against real store buckets"
181-
THANOS_TEST_PROMETHEUS_VERSIONS="$(PROM_VERSIONS)" THANOS_TEST_ALERTMANAGER_PATH="alertmanager-$(ALERTMANAGER_VERSION)" go test $(shell go list ./... | grep -v /vendor/ | grep -v /benchmark/);
181+
THANOS_TEST_PROMETHEUS_VERSIONS="$(PROM_VERSIONS)" THANOS_TEST_ALERTMANAGER_PATH="alertmanager-$(ALERTMANAGER_VERSION)" go test $(shell go list ./... | grep -v /vendor/);
182182

183183
.PHONY: test-only-gcs
184184
test-only-gcs: export THANOS_SKIP_S3_AWS_TESTS = true
@@ -232,7 +232,7 @@ web: web-pre-process $(HUGO)
232232
lint: check-git $(GOLANGCILINT)
233233
@echo ">> checking formatting"
234234
@$(GOLANGCILINT) run -v --disable-all -E goimports ./...
235-
@echo ">> linting all of the Go files"
235+
@echo ">> linting all of the Go files. GOGC=${GOGC}"
236236
@$(GOLANGCILINT) run -v ./...
237237

238238
.PHONY: web-serve

cmd/thanos/query.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,7 @@ func runQuery(
399399
}
400400

401401
ins := extpromhttp.NewInstrumentationMiddleware(reg)
402-
403-
ui.NewQueryUI(logger, stores, flagsMap).Register(router.WithPrefix(webRoutePrefix), ins)
402+
ui.NewQueryUI(logger, reg, stores, flagsMap).Register(router.WithPrefix(webRoutePrefix), ins)
404403

405404
api := v1.NewAPI(logger, reg, engine, queryableCreator, enableAutodownsampling, enablePartialResponse)
406405

cmd/thanos/rule.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,9 @@ func runRule(
529529

530530
ins := extpromhttp.NewInstrumentationMiddleware(reg)
531531

532-
ui.NewRuleUI(logger, ruleMgrs, alertQueryURL.String(), flagsMap).Register(router.WithPrefix(webRoutePrefix), ins)
532+
ui.NewRuleUI(logger, reg, ruleMgrs, alertQueryURL.String(), flagsMap).Register(router.WithPrefix(webRoutePrefix), ins)
533533

534-
api := v1.NewAPI(logger, ruleMgrs)
534+
api := v1.NewAPI(logger, reg, ruleMgrs)
535535
api.Register(router.WithPrefix(path.Join(webRoutePrefix, "/api/v1")), tracer, logger, ins)
536536

537537
mux := http.NewServeMux()

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
module github.com/thanos-io/thanos
22

3+
// TODO(bwplotka): Pin to https://github.com/prometheus/prometheus/pull/5703 until it's merged.
4+
replace github.com/prometheus/prometheus => github.com/prometheus/prometheus v0.0.0-20190814100250-bd8bf91426aa
5+
36
require (
47
cloud.google.com/go v0.44.1
58
github.com/Azure/azure-storage-blob-go v0.7.0

go.sum

Lines changed: 40 additions & 4 deletions
Large diffs are not rendered by default.

pkg/promclient/promclient_e2e_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
func TestIsWALFileAccesible_e2e(t *testing.T) {
2323
testutil.ForeachPrometheus(t, func(t testing.TB, p *testutil.Prometheus) {
2424
testutil.Ok(t, p.Start())
25-
defer func() { testutil.Ok(t, p.Stop()) }()
2625

2726
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
2827
defer cancel()
@@ -43,7 +42,6 @@ global:
4342
`))
4443

4544
testutil.Ok(t, p.Start())
46-
defer func() { testutil.Ok(t, p.Stop()) }()
4745

4846
u, err := url.Parse(fmt.Sprintf("http://%s", p.Addr()))
4947
testutil.Ok(t, err)
@@ -60,7 +58,6 @@ global:
6058
func TestConfiguredFlags_e2e(t *testing.T) {
6159
testutil.ForeachPrometheus(t, func(t testing.TB, p *testutil.Prometheus) {
6260
testutil.Ok(t, p.Start())
63-
defer func() { testutil.Ok(t, p.Stop()) }()
6461

6562
u, err := url.Parse(fmt.Sprintf("http://%s", p.Addr()))
6663
testutil.Ok(t, err)
@@ -96,7 +93,6 @@ func TestSnapshot_e2e(t *testing.T) {
9693
testutil.Ok(t, err)
9794

9895
testutil.Ok(t, p.Start())
99-
defer func() { testutil.Ok(t, p.Stop()) }()
10096

10197
u, err := url.Parse(fmt.Sprintf("http://%s", p.Addr()))
10298
testutil.Ok(t, err)

pkg/query/api/v1.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ type API struct {
104104
rangeQueryDuration prometheus.Histogram
105105
enableAutodownsampling bool
106106
enablePartialResponse bool
107-
now func() time.Time
107+
reg prometheus.Registerer
108+
109+
now func() time.Time
108110
}
109111

110112
// NewAPI returns an initialized API type.
@@ -143,6 +145,7 @@ func NewAPI(
143145
rangeQueryDuration: rangeQueryDuration,
144146
enableAutodownsampling: enableAutodownsampling,
145147
enablePartialResponse: enablePartialResponse,
148+
reg: reg,
146149

147150
now: time.Now,
148151
}

pkg/receive/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ import (
2323
"github.com/prometheus/client_golang/prometheus"
2424
"github.com/prometheus/client_golang/prometheus/promhttp"
2525
"github.com/prometheus/common/route"
26+
"github.com/prometheus/prometheus/prompb"
2627
promtsdb "github.com/prometheus/prometheus/storage/tsdb"
2728
terrors "github.com/prometheus/prometheus/tsdb/errors"
2829
"github.com/thanos-io/thanos/pkg/runutil"
29-
"github.com/thanos-io/thanos/pkg/store/prompb"
3030
)
3131

3232
// Options for the web Handler.

pkg/receive/hashring.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"sort"
88
"sync"
99

10-
"github.com/thanos-io/thanos/pkg/store/prompb"
10+
"github.com/prometheus/prometheus/prompb"
1111

1212
"github.com/cespare/xxhash"
1313
)

0 commit comments

Comments
 (0)