newrelic / newrelic-telemetry-sdk-go

Go library for sending telemetry data to New Relic
Apache License 2.0
42 stars 30 forks source link

Feature: Add ability to gracefully shutdown the harvester. #26

Open carlosroman opened 4 years ago

carlosroman commented 4 years ago

Currently the harvester runs a go routine with tick that will tick forever. It would be good to be able to stop the ticker when the harvester is no longer needed.

Miriam-R commented 3 years ago

Next steps: Make sure there's a shutdown event in our harvester for the Telemetry SDK.

RichVanderwal commented 3 years ago

Currently, I believe the caller should call HarvestNow() to make sure all the data is sent, and it's just assumed the ticker will stop due to the whole application shutting down. Here's what happens in the New Relic OpenTelemetry Exporter: https://github.com/newrelic/opentelemetry-exporter-go/blob/7c24e335d64821f6aaec96e1c48d478bcb290d70/newrelic/exporter.go#L205 No mention of stopping a ticker. We should stop the ticker when Exporter.Shutdown() is called.