var utils = require('../utils')
var transactionStore = require('../transactionStore')

module.exports = function ($provide, traceBuffer) {
  // Controller Instrumentation
  $provide.decorator('$controller', ['$delegate', '$injector', function ($delegate, $injector) {
    return function () {
      var args = Array.prototype.slice.call(arguments)
      var controllerInfo = utils.getControllerInfoFromArgs(args)

      if(controllerInfo.name) { // Only instrument controllers with a name
        return utils.instrumentModule($delegate, $injector, {
          type: 'app.$controller',
          prefix: '$controller.' + controllerInfo.name
        }).apply(this, arguments)
      }

      return $delegate.apply(this, args)
    }
  }])
}

var utils = require('../utils')
var transactionStore = require('../transactionStore')

module.exports = function ($provide, traceBuffer) {
  // Controller Instrumentation
  $provide.decorator('$controller', ['$delegate', '$injector', function ($delegate, $injector) {
    return function () {
      var args = Array.prototype.slice.call(arguments)
      var controllerInfo = utils.getControllerInfoFromArgs(args)

      if(controllerInfo.name) { // Only instrument controllers with a name
        return utils.instrumentModule($delegate, $injector, {
          traceBuffer: traceBuffer,
          type: 'app.$controller',
          prefix: '$controller.' + controllerInfo.name
        }).apply(this, arguments)
      }

      return $delegate.apply(this, args)
    }
  }])
}

Make sure traceBuffer is referenced
Make sure traceBuffer is referenced