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

store: add handling code for older Prometheus versions #4628

Merged
merged 2 commits into from
Sep 4, 2021

Conversation

GiedriusS
Copy link
Member

@GiedriusS GiedriusS commented Sep 2, 2021

Handle older Prometheus versions that do not support match[]. Add
tests that cover new code. The new code is largely modeled after the
LabelValues() code.

It fixes #4586 (comment) and unblocks the release.

Signed-off-by: Giedrius Statkevičius [email protected]

Handle older Prometheus versions that do not support `match[]`. Add
tests that cover new code. The new code is largely modeled after the
LabelValues() code.

Signed-off-by: Giedrius Statkevičius <[email protected]>
@yeya24
Copy link
Contributor

yeya24 commented Sep 2, 2021

Code looks good but we still need to fix the test.

goroutine 1606 [running]:
testing.tRunner.func1.2(0x13c9620, 0x2003350)
	/usr/local/go/src/testing/testing.go:1143 +0x332
testing.tRunner.func1(0xc0629d7980)
	/usr/local/go/src/testing/testing.go:1146 +0x4b6
panic(0x13c9620, 0x2003350)
	/usr/local/go/src/runtime/panic.go:965 +0x1b9
github.com/thanos-io/thanos/pkg/store.(*PrometheusStore).LabelNames(0xc0004b3d60, 0x18024d0, 0xc0020cb380, 0xc0005c7f08, 0x0, 0x0, 0x0)
	/home/circleci/project/pkg/store/prometheus.go:512 +0x3e
github.com/thanos-io/thanos/pkg/store.TestPrometheusStore_LabelNames_e2e(0xc0629d7980)
	/home/circleci/project/pkg/store/prometheus_test.go:381 +0x965
testing.tRunner(0xc0629d7980, 0x15f9798)
	/usr/local/go/src/testing/testing.go:1193 +0xef
created by testing.(*T).Run
	/usr/local/go/src/testing/testing.go:1238 +0x2b3

We need to pass a version function to github.com/thanos-io/thanos/pkg/store.TestPrometheusStore_LabelNames_e2e

@GiedriusS
Copy link
Member Author

Code looks good but we still need to fix the test.

goroutine 1606 [running]:
testing.tRunner.func1.2(0x13c9620, 0x2003350)
	/usr/local/go/src/testing/testing.go:1143 +0x332
testing.tRunner.func1(0xc0629d7980)
	/usr/local/go/src/testing/testing.go:1146 +0x4b6
panic(0x13c9620, 0x2003350)
	/usr/local/go/src/runtime/panic.go:965 +0x1b9
github.com/thanos-io/thanos/pkg/store.(*PrometheusStore).LabelNames(0xc0004b3d60, 0x18024d0, 0xc0020cb380, 0xc0005c7f08, 0x0, 0x0, 0x0)
	/home/circleci/project/pkg/store/prometheus.go:512 +0x3e
github.com/thanos-io/thanos/pkg/store.TestPrometheusStore_LabelNames_e2e(0xc0629d7980)
	/home/circleci/project/pkg/store/prometheus_test.go:381 +0x965
testing.tRunner(0xc0629d7980, 0x15f9798)
	/usr/local/go/src/testing/testing.go:1193 +0xef
created by testing.(*T).Run
	/usr/local/go/src/testing/testing.go:1238 +0x2b3

We need to pass a version function to github.com/thanos-io/thanos/pkg/store.TestPrometheusStore_LabelNames_e2e

Thank you! I have just deleted that test since it is now covered by TestPrometheusStore_LabelAPIs_e2e. I really need to add pre-commit hooks so that make test-local would be executed before committing because now I only ran the new test, and didn't catch this as a result :/

Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

LGTM!

@yeya24 yeya24 merged commit bd134d7 into thanos-io:main Sep 4, 2021
@GiedriusS GiedriusS deleted the add_workaround_for_older_versions branch September 6, 2021 10:47
@bwplotka
Copy link
Member

bwplotka commented Sep 6, 2021

Thanks for quick fix!

someshkoli pushed a commit to someshkoli/thanos that referenced this pull request Nov 7, 2021
* store: add handling code for older Prometheus versions

Handle older Prometheus versions that do not support `match[]`. Add
tests that cover new code. The new code is largely modeled after the
LabelValues() code.

Signed-off-by: Giedrius Statkevičius <[email protected]>

* store: delete test that is covered by another test

Signed-off-by: Giedrius Statkevičius <[email protected]>
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.

3 participants