Skip to content

Commit 5ad19d7

Browse files
committed
Finished up APM prototype and tests
1 parent 1d4354c commit 5ad19d7

File tree

3 files changed

+309
-234
lines changed

3 files changed

+309
-234
lines changed

lib/apm.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,8 @@ var Instrumentation = function(core, options, callback) {
5656
var instrumentations = []
5757

5858
// Classes to support
59-
var classes = [GridStore, Server, ReplSet, Mongos,
60-
OrderedBulkOperation, UnorderedBulkOperation, CommandCursor, AggregationCursor,
61-
Cursor, Collection, Db];
59+
var classes = [GridStore, OrderedBulkOperation, UnorderedBulkOperation,
60+
CommandCursor, AggregationCursor, Cursor, Collection, Db];
6261

6362
// Add instrumentations to the available list
6463
for(var i = 0; i < classes.length; i++) {
@@ -375,7 +374,6 @@ var Instrumentation = function(core, options, callback) {
375374
return self.emit('succeeded', command)
376375
}
377376

378-
379377
// Add our callback handler
380378
args.push(function(err, r) {
381379
if(err) {
@@ -464,6 +462,11 @@ Instrumentation.prototype.uninstrument = function() {
464462
var obj = this.overloads[i];
465463
obj.proto[obj.name] = obj.func;
466464
}
465+
466+
// Remove all listeners
467+
this.removeAllListeners('started');
468+
this.removeAllListeners('succeeded');
469+
this.removeAllListeners('failed');
467470
}
468471

469472
module.exports = Instrumentation;

0 commit comments

Comments
 (0)