opentelemetry-collector-contrib
opentelemetry-collector-contrib copied to clipboard
[exporter/signalfx] Fix goroutine leaks
Description: <Describe what has changed.>
This change is a refactor to allow us to enable goleak
checks in each of the exporter's sub-directories, as well as the signalfx receiver (which uses the signalfxexporter in a test). The main idea is to use start
/shutdown
for each package's functionality, rather than relying on the top level context cancel of the exporter. The addition of start and shutdowns for each package means we can more closely control the lifecycle of each as needed, and enable goleak
for each package.
The memory leaks being fixed are:
- Call the
TTLMap.Shutdown
so the ticker is properly stopped:t.prevPts.Shutdown()
. - Don't block waiting for a request if the context is cancelled.
Link to tracking issue: #30438
~Did some more testing, looks like I've broken something during shutdown. I'll investigate and move back to ready to review when I've figured out what's going on.~
Nevermind, I was running tests using the hostmetrics
receiver and didn't realize it blocks shutdown until active scrape operations are complete. I tested with debug
exporter, and signalfx
exporter before these changes, and everything is working as previously.
This PR was marked stale due to lack of activity. It will be closed in 14 days.