go-sensor
go-sensor copied to clipboard
Added ShutdownSensor() function
This PR introduces a new public instana.ShutdownSensor()
function, responsible for cleaning up the internal global sensor reference.
This is the first phase of a two phase refactoring.
Why
Although we want the global internal sensor to be available at all times in a real case scenario, the same global sensor compromises our tests, since we are blindly using always the same instance of it, which comes together with an agent client instance, as well as a fsm instance. All with an initial setup.
With a cleanup of this sensor, we can assure that no tests are passing with a false positive, and potentially uncover hidden issues in the tracer.
Later on, once this new function is merged into the master branch and a new release of the tracer is done, the second phase of the refactoring comes in: to update all instrumentations to the new version, and making usage of the new function to cleanup the sensor after each test.