Update to make dtrace-provider optional.

This commit is contained in:
Evan Shortiss 2014-04-01 23:02:11 -04:00
parent d20308265a
commit a84546b7bd
2 changed files with 25 additions and 2 deletions

View File

@ -79,7 +79,28 @@ var SERVER_PROBES = {
module.exports = function () {
if (!SERVER_PROVIDER) {
SERVER_PROVIDER = dtrace.createDTraceProvider('ldapjs');
try {
var dtrace = require('dtrace-provider');
SERVER_PROVIDER = dtrace.createDTraceProvider('restify');
} catch (e) {
SERVER_PROVIDER = {
fire: function () {
},
enable: function () {
},
addProbe: function () {
var p = {
fire: function () {
}
};
return (p);
},
removeProbe: function () {
},
disable: function () {
}
};
}
Object.keys(SERVER_PROBES).forEach(function (p) {
var args = SERVER_PROBES[p].splice(0);

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"