Upadte to make dtrace-provider optional. Fix bug in original update.

This commit is contained in:
Evan Shortiss 2014-04-02 10:51:10 -04:00
parent b3b26a48fa
commit 9afecfd788
1 changed files with 8 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
@ -82,6 +80,13 @@ module.exports = function () {
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);
dtrace.DTraceProvider.prototype.addProbe.apply(SERVER_PROVIDER, args);
});
} catch (e) {
SERVER_PROVIDER = {
fire: function () {
@ -102,13 +107,6 @@ module.exports = function () {
};
}
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);
});
SERVER_PROVIDER.enable();
SERVER_PROVIDER._nextId = function () {