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

exporter/prometheusremotewriteexporter: import and add official compliance tests. #5014

Conversation

kirbyquerby
Copy link
Member

@kirbyquerby kirbyquerby commented Aug 30, 2021

Description: exporter/prometheusremotewrite: import and add official compliance tests.
This change imports and runs the official Prometheus Remote Write compliance tests from https://github.com/prometheus/compliance against a live collector end-to-end. Due to data races in the official tests, this test is currently skipped.

Link to tracking Issue: Fixes open-telemetry/prometheus-interoperability-spec/issues/34

Testing: This change itself is a test :)

@kirbyquerby kirbyquerby force-pushed the wg-issue-34/prom-wr-compliance branch 2 times, most recently from 96d2db3 to 768db57 Compare August 30, 2021 19:29
@kirbyquerby kirbyquerby changed the title exporter/prometheusremotewriteexporter: add prometheus remote write compatibility tests. exporter/prometheusremotewriteexporter: import and add official compliance tests. Aug 30, 2021
@kirbyquerby kirbyquerby force-pushed the wg-issue-34/prom-wr-compliance branch from 768db57 to 834d67c Compare August 30, 2021 19:32
@kirbyquerby kirbyquerby marked this pull request as ready for review August 30, 2021 19:32
@kirbyquerby kirbyquerby requested review from a team and codeboten August 30, 2021 19:32
@kirbyquerby
Copy link
Member Author

/cc @odeke-em

Copy link
Member

@odeke-em odeke-em left a comment

Choose a reason for hiding this comment

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

LGTM, thank you @kirbyquerby! Minor nit, please examine the 10s artificial sleep and also add a function to properly shut down lest we'll encounter race conditions with the OpenTelemetry service as I've encountered before.

app := startCollector(t, l.Addr())
defer app.Shutdown()

time.Sleep(10 * time.Second)
Copy link
Member

Choose a reason for hiding this comment

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

Why this artificial sleep? Could we perhaps reduce this as much.

Copy link
Member Author

Choose a reason for hiding this comment

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

The 10s sleep comes from the original tests: https://github.com/prometheus/compliance/blob/main/remote_write/main_test.go#L102
The collector process is interrupted after TIMEOUT seconds: https://github.com/prometheus/compliance/blob/main/remote_write/targets/common.go#L276

We can potentially lower timeout by some amount without causing flakiness. Once we fix the go modules issues, I can try playing around with lower values.

Copy link
Member

Choose a reason for hiding this comment

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

No worries, we can keep them as they are.

Copy link
Member Author

@kirbyquerby kirbyquerby left a comment

Choose a reason for hiding this comment

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

Thanks for the review Emmanuel!

app := startCollector(t, l.Addr())
defer app.Shutdown()

time.Sleep(10 * time.Second)
Copy link
Member Author

Choose a reason for hiding this comment

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

The 10s sleep comes from the original tests: https://github.com/prometheus/compliance/blob/main/remote_write/main_test.go#L102
The collector process is interrupted after TIMEOUT seconds: https://github.com/prometheus/compliance/blob/main/remote_write/targets/common.go#L276

We can potentially lower timeout by some amount without causing flakiness. Once we fix the go modules issues, I can try playing around with lower values.

@odeke-em
Copy link
Member

odeke-em commented Sep 3, 2021

Kindly requesting y'all eyes @Aneurysm9 @bogdandrutu @tigrannajaryan.

@kirbyquerby kirbyquerby force-pushed the wg-issue-34/prom-wr-compliance branch 2 times, most recently from 4472318 to bfbf0ca Compare September 7, 2021 22:06
@odeke-em
Copy link
Member

Kindly pinging y'all, it's been 11 days and the PR is getting stale. Kindly cc-ing @dashpole

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

Code looks good, please address the conflicts. It looks like lint and the tests are failing as well:

exporter/prometheusremotewriteexporter/compliance/compliance_test.go: Expected no more than 3 groups, got 4

@kirbyquerby kirbyquerby force-pushed the wg-issue-34/prom-wr-compliance branch from bfbf0ca to 3f08474 Compare September 10, 2021 23:27
Copy link
Contributor

@dashpole dashpole left a comment

Choose a reason for hiding this comment

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

LGTM!

@kirbyquerby
Copy link
Member Author

There are currently data races in the compliance tests (and in the collector) that cause this test to fail with -race, so for now it's skipped. I've created prometheus/compliance#40 for the compliance races and can work on the races in the collector after the compliance test races are fixed).

@kirbyquerby
Copy link
Member Author

The CI check failures appear to be caused elsewhere. See this clean PR which also fails checks: #5228

@kirbyquerby kirbyquerby force-pushed the wg-issue-34/prom-wr-compliance branch from 96c17df to 95ce1cc Compare September 13, 2021 22:03
@kirbyquerby
Copy link
Member Author

I was mistaken :)
After running a bunch of go mod tidys, everything seems to be in order (other than loadtest >:( ). No idea why #5228 is failing. Flaky tests?

@odeke-em
Copy link
Member

Code looks good, please address the conflicts. It looks like lint and the tests are failing as well:

exporter/prometheusremotewriteexporter/compliance/compliance_test.go: Expected no more than 3 groups, got 4

@codeboten please take a look again. The Prometheus Remote Writer test code has data races they'll need to fix. On our end though we are good to go.

@kirbyquerby kirbyquerby force-pushed the wg-issue-34/prom-wr-compliance branch from 7ea9db7 to 8bf4140 Compare September 14, 2021 22:08
@odeke-em
Copy link
Member

Kindly cc-ing @alolita @bogdandrutu @codeboten @Aneurysm9 to take a look before this PR gets stale again, thank you!

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

i suspect another make gotidy is needed here to address the conflicts.

@kirbyquerby kirbyquerby force-pushed the wg-issue-34/prom-wr-compliance branch 2 times, most recently from 055d1b2 to 24bcded Compare September 15, 2021 23:07
@kirbyquerby
Copy link
Member Author

Rebased + gotidied. Thanks for the review Alex!

@kirbyquerby kirbyquerby force-pushed the wg-issue-34/prom-wr-compliance branch from e5803c7 to 9751f72 Compare September 16, 2021 19:20
…iance tests.

run make gotidy


run make gotidy again

????????
run go mod tidy manually in prometheusexporter


run make gotidy after rebasing


make gotidy


manually run go mod tidy in prometheusexporter
@kirbyquerby kirbyquerby force-pushed the wg-issue-34/prom-wr-compliance branch from 9751f72 to cf48dff Compare September 20, 2021 19:18

var (
logger = log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr))
tests = []func() cases.Test{
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure that duplicating the test harness here is the best approach. Can we instead have an action that runs on PR that pulls the compliance test repo and runs the tests there against a build artifact?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I've made #5739

@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@tigrannajaryan
Copy link
Member

Please resolve the conflicts and address/resolve remaining open comments.

@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 7 days.

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

@kirbyquerby can this be closed as superseeded by #5739?

@kirbyquerby
Copy link
Member Author

@codeboten Yeah :D

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.

[Tracker Issue] Add Prometheus Remote Write compatibility tests to OTel Collector
9 participants