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

PMM-13426: Fix PBM collector memory leak #928

Merged
merged 8 commits into from
Oct 11, 2024
Merged
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion exporter/pbm_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,16 @@ func (p *pbmCollector) collect(ch chan<- prometheus.Metric) {
logger.Errorf("failed to create PBM client from uri %s: %s", p.mongoURI, err.Error())
return
}
defer func() {
err := pbmClient.Close(p.ctx)
if err != nil {
logger.Errorf("failed to close PBM client: %v", err)
}
}()

pbmConfig, err := pbmClient.GetConfig(p.ctx)
if err != nil {
logger.Errorf("failed to get PBM configuration: %s", err.Error())
logger.Warnf("failed to get PBM configuration: %s", err.Error())
Copy link
Member

Choose a reason for hiding this comment

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

I think it should be Info level if we expect that pbm config might not exist there

}

if pbmConfig != nil {
Expand Down