This ensures that we pick up when the singleton client changes, to ensure backwards compatible behaviour.
With the legacy client, this was not an issue because you would always make in-place config changes on the only LegacyClient instance. With the new client, you would have to instantiate a complete new client, and assign it to StatsD.singleton_client. Those reassignments would be lost for metaprogramming methods before, if they would happen after the metaprogaramming method was evaluated.
This ensures that we pick up when the singleton client changes, to ensure backwards compatible behaviour.
With the legacy client, this was not an issue because you would always make in-place config changes on the only LegacyClient instance. With the new client, you would have to instantiate a complete new client, and assign it to
StatsD.singleton_client
. Those reassignments would be lost for metaprogramming methods before, if they would happen after the metaprogaramming method was evaluated.