mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-09-29 00:00:42 -04:00
Adds a new instrumentation callback called `request_begin` which, as the name suggests, is invoked before an HTTP request is dispatched. As outlined originally in #900, the idea is that this will enable a set of hooks that can be used for distributed tracing. The PR also renames the existing `request` callback to `request_end`, although the old name is still invoked for the time being for backwards compatibility. A special `user_data` property is passed to `request_begin` which allows subscribers to set custom data that will be passed through to `request_end` for any given request. This allows, for example, a user assigned ID to be set for the request and recognized on both ends. I chose the naming `_begin` and `_end` (as opposed to start/finish or any other combination) based on the naming conventions of Ruby itself. Fixes #900.