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

scrape_test: add scrape offset in test scraper to avoid race #119

Conversation

ridwanmsharif
Copy link
Collaborator

This change adds an offset to the test scraper so a scrape is not initiated when the context is cancelled. Without this change, there was a race between the context cancellation and the scrape jitter wait and this change fixes that.

Can verify using:
go test -run ^TestScrapeLoopStopBeforeRun$ github.com/prometheus/prometheus/scrape -race -count 1000

This change adds an offset to the test scraper so a scrape is not
initiated when the context is cancelled. Without this change, there
was a race between the context cancellation and the scrape jitter wait
and this change fixes that.

Can verify using:
go test -run ^TestScrapeLoopStopBeforeRun$ github.com/prometheus/prometheus/scrape -race -count 1000

Signed-off-by: Ridwan Sharif <ridwanmsharif@google.com>
@bwplotka bwplotka merged commit 5e5cf36 into GoogleCloudPlatform:feature/shutdownscrape Nov 20, 2023
18 checks passed
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