Skip to content

Commit

Permalink
Service Api collection close servicehandler to avoid memory leak
Browse files Browse the repository at this point in the history
Signed-off-by: Alvaro Cabanas <acabanas@newrelic.com>
  • Loading branch information
alvarocabanas committed Sep 23, 2021
1 parent 5931604 commit f4f5aaf
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions collector/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,18 +246,17 @@ func (c *serviceCollector) collectAPI(ch chan<- prometheus.Metric) error {
if err != nil {
continue
}
defer serviceHandle.Close()

// Get Service Configuration
serviceConfig, err := serviceHandle.Config()
if err != nil {
_ = serviceHandle.Close()
continue
}

// Get Service Current Status
serviceStatus, err := serviceHandle.Query()
if err != nil {
_ = serviceHandle.Close()
continue
}

Expand Down

0 comments on commit f4f5aaf

Please sign in to comment.