lightstep / lightstep-tracer-go

The Lightstep distributed tracing library for Go
https://lightstep.com
MIT License
98 stars 54 forks source link

Fix test data races #222

Closed iredelmeier closed 4 years ago

iredelmeier commented 4 years ago

This should fix (with a fairly gross hack...) the data race that's currently preventing other fixes.

In this case, the problem is with a data race that is only possible in tests, and then only with tests that are run from the same internal package (i.e., package lightstep). The tests currently write to the tracer's internal state after the tracer has been constructed, which is being accessed concurrently by the run loop that starts during construction.

A "better" fix might be to refactor, e.g., to use an internal package. While this may be an architecturally preferable route, it doesn't make sense to invest in a large change with OpenTelemetry on the horizon.