signalfx / signalfx-go

Go client library and instrumentation bindings for SignalFx
https://www.signalfx.com
Apache License 2.0
14 stars 51 forks source link

Move initialization of writer fields outside of go routine #95

Closed mstumpfx closed 4 years ago

mstumpfx commented 4 years ago

The writer's ring buffer may have not been initialized inside its go routine before another routine may call the InternalMetrics function, which accesses the writer's ring buffer, causing a panic.

This PR moves the initialization of several writer fields into the writer's Start function, before the new go routine is created to run the writer.

mstumpfx commented 4 years ago

@keitwb I'm not sure if the internal metrics are appropriately renamed or not when I ran the code generation. I can change back to "datapoints" if needed.

mstumpfx commented 4 years ago

Yeah the sed in gen.sh expects to be run on a GNU based system I think, so my OSX isn't doing the substitutions. I manually edited the datapoint names back to normal rather than fight sed.