Bart 26a0964e56 Add simple instrumentation callback (#870)
* Add simple instrumentation callback

We used to insert Faraday::Request::Instrumentation into our Faraday middleware
stack to be able to instrument Stripe calls with StatsD. With Faraday being
removed in version 5, this required some rework. This commit implements a simple
callback system that can be used with any kind of instrumentation system.

* Add a topic to Stripe::Instrumentation notifications

... and a :request topic to subscribe to

* Use a RequestEvent value object instead of positional args in callback

This way the RequestLogContext object doesn't get exposed externally. Since the
same value object can be received by multiple subscribers it is frozen to
prevent accidental mutations across threads.

* Relocate tests for instrumentation and add more tests
2019-11-07 14:18:11 -08:00
..