styleseek/hyperdrive — pull request #30 by xentek (2014-05-20 19:34:43+00:00)
Title: 17 instrumenter

- Adds instrumenter support to `hyperdrive`, with the interface proposed by @jnunemaker in this blog post: http://www.railstips.org/blog/archives/2013/01/23/an-instrumented-library-in-30-lines/
- implementation is slightly different but the `instrument(name, payload, &optional_block)` interface is the same.
- can be configured with the DSL:
````ruby
hyperdrive do
instrumenter MyInstrumenter.new
end
````
- the configured instrumenter be called anywhere with `hyperdrive.instrument`
- can be called inside `before` callbacks and `request` handlers with the shorter `instrument` method, which is just a wrapper around `hyperdrive.instrument`
- ships with the default `Hyperdrive::Instrumenter::Noop` class which just returns the given payload (modified by the optional block or not) and a `Hyperdrive::Instrumenter::Memory` which can be used by library users in tests (and is being used in hyperdrive's own specs).

This pull request does not add any instrumentation to hyperdrive itself, but that is on the road map in the near term.