Merge pull request #173 from evanshortiss/master

Make dtrace-provider an optional dependency
This commit is contained in:
Mark Cavage 2014-04-02 08:46:13 -07:00
commit 5203429d76
2 changed files with 31 additions and 10 deletions

View File

@ -1,6 +1,4 @@
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
var dtrace = require('dtrace-provider');
// Copyright 2011 Mark Cavage, Inc. All rights reserved.s
@ -79,14 +77,35 @@ var SERVER_PROBES = {
module.exports = function () {
if (!SERVER_PROVIDER) {
SERVER_PROVIDER = dtrace.createDTraceProvider('ldapjs');
try {
var dtrace = require('dtrace-provider');
SERVER_PROVIDER = dtrace.createDTraceProvider('ldapjs');
Object.keys(SERVER_PROBES).forEach(function (p) {
var args = SERVER_PROBES[p].splice(0);
args.unshift(p);
Object.keys(SERVER_PROBES).forEach(function (p) {
var args = SERVER_PROBES[p].splice(0);
args.unshift(p);
dtrace.DTraceProvider.prototype.addProbe.apply(SERVER_PROVIDER, args);
});
dtrace.DTraceProvider.prototype.addProbe.apply(SERVER_PROVIDER, args);
});
} catch (e) {
SERVER_PROVIDER = {
fire: function () {
},
enable: function () {
},
addProbe: function () {
var p = {
fire: function () {
}
};
return (p);
},
removeProbe: function () {
},
disable: function () {
}
};
}
SERVER_PROVIDER.enable();

View File

@ -30,10 +30,12 @@
"asn1": "0.1.11",
"assert-plus": "0.1.2",
"bunyan": "0.21.1",
"dtrace-provider": "0.2.8",
"nopt": "2.1.1",
"pooling": "0.4.5"
},
"optionalDependencies": {
"dtrace-provider": "0.2.8"
},
"devDependencies": {
"tap": "0.4.1",
"node-uuid": "1.4.0"