var globalRequest = require('request');
var Prober = require('airlock');
var xtend = require('xtend');

module.exports = ProbingRequestHandler;
function ProbingRequestHandler(requestHandler, options) {
    if (!(this instanceof ProbingRequestHandler)) {
        return new ProbingRequestHandler(requestHandler, options);
    }
    this.prober = options.prober = Prober({
        enabled: true,
        title: 'typed-request-client',
        statsd: options.statsd
    });
    // TODO consider moving this one line into a separate layer.
    options.request = options.request || globalRequest;
    this.requestHandler = requestHandler;
    this.options = options;
}

ProbingRequestHandler.prototype.request =
function handleProbingRequest(request, opts, cb) {
    opts = xtend(opts, {request: this.options.request});
    var thunk = this.requestHandler.request.bind(
        this.requestHandler,
        request,
        opts
    );
    this.prober.probe(thunk, cb);
};

@@ -95,16 +95,54 @@
 xtend');
+%0Avar errors = require('../errors.js');
 %0A%0Amodule
@@ -358,16 +358,175 @@
 ;%0A    %7D%0A
+%0A    if (typeof options.clientName !== 'string') %7B%0A        throw errors.MissingClientName(%7B%0A            optionsStr: JSON.stringify(options)%0A        %7D);%0A    %7D%0A%0A
     this
@@ -620,17 +620,39 @@
 t-client
-'
+.' + options.clientName
 ,%0A      

Update the client name used in prober, so we could separate prober statsd data for multiple clients.