Skip to content

test(registry): Add goleak-based goroutine leak detection #1797

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

Merged
merged 1 commit into from
Apr 24, 2025

Conversation

surinkim
Copy link
Contributor

test(registry): Add goleak-based goroutine leak detection test for Registry.Gather

This commit adds a new test case TestGatherDoesNotLeakGoroutines which verifies that repeated calls to Registry.Gather() do not leak goroutines.

  • 100 collectors are registered to a custom registry
  • Gather() is called 1000 times
  • goleak.VerifyNone ensures that no unexpected goroutines remain

This test serves as a future safeguard to detect goroutine leaks under heavy usage.

@surinkim surinkim force-pushed the test/registry-goleak branch from 44b3d1e to 2ac28a9 Compare April 13, 2025 15:15
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Generally LGTM -- was there any historical leak that trigger this PR?

One thing to ensure -- does this upset client_golang importers in terms of extra dependency. I assume NO given we only import this in test, importers should not see it (in theory).

@bwplotka bwplotka merged commit 96a5ad6 into prometheus:main Apr 24, 2025
9 checks passed
@bwplotka
Copy link
Member

Thanks!

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