basho-labs/riak-js — pull request #8 by roidrage (2012-11-06 15:10:36+00:00)
Title: Add request instrumentation

WIP, not ready to merge.

This extracts the request handling code from the client into a new object.

It allows adding listeners to the client that can register for events triggered by the request, e.g.

```javascript
var listener = {
'request.start': function(event) {
console.log("Request started at: " + event.started_at);
}
}

db.registerListener(listener);
```

Will evolve this code into having a sample for instrumentation that tracks the time between start and finished, and another listener for logging, which is currently baked into the request directly.