cpp_client_telemetry
cpp_client_telemetry copied to clipboard
Remove global C++ objects
Telemetry API should be accessible before global C++ objects (with non-trivial constructors) are constructed. This may happen when executing code in +load in Obj-C runtime, which starts before C++ globals construction, or in case of global C++ constructors race, where the order of constructors is not guaranteed in some runtimes. The replacements for such problematic globals are accessor functions with local static objects created on demand.
Changes looked good to me initially, but I didn't think about the backward compatibility aspects. In existing setup, there is nothing stopping the applications to build their own logic around these global statics, and all these applications need to change with this PR.
While I do see this change in the right direction, we need to carefully plan for any such breaking change as part of v4 design (which is tentatively planned for next Azure semester).
@mkoscumb if you have any further comments here.