While trying to use a custom StatsD client for our project (see https://github.com/Shopify/help/pull/24350) we discovered a bug. The new client was being set properly but the new custom client was not being passed into expectations so there ends up being a discrepancy with the result and the expectation. This is because there is no separate parameter for client when initializing a new expectation and the options that are being passed into StatsD::Instrument::Expectation do not contain the new client and so the expectation ends up defaulting to StatsD.singleton_client.
Explicitly adding the new client to the options as such, and initializing it, ensures that the new client is passed up to expectations:
While trying to use a custom StatsD client for our project (see https://github.com/Shopify/help/pull/24350) we discovered a bug. The new client was being set properly but the new custom client was not being passed into expectations so there ends up being a discrepancy with the result and the expectation. This is because there is no separate parameter for client when initializing a new expectation and the options that are being passed into
StatsD::Instrument::Expectation
do not contain the new client and so the expectation ends up defaulting toStatsD.singleton_client
.Explicitly adding the new client to the options as such, and initializing it, ensures that the new client is passed up to expectations: