Merge pull request #173 from evanshortiss/master
Make dtrace-provider an optional dependency
This commit is contained in:
commit
5203429d76
|
@ -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();
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue