How to use the dtrace-provider.createDTraceProvider function in dtrace-provider

To help you get started, we’ve selected a few dtrace-provider examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github science / openthermo / server / node_modules / restify / node_modules / bunyan / lib / bunyan.js View on Github external
this.serializers = objCopy(parent.serializers);
        this.src = parent.src;
        this.fields = objCopy(parent.fields);
        if (options.level) {
            this.level(options.level);
        }
    } else {
        this._level = Number.POSITIVE_INFINITY;
        this.streams = [];
        this.serializers = null;
        this.src = false;
        this.fields = {};
    }

    if (!dtp && dtrace) {
        dtp = dtrace.createDTraceProvider('bunyan');

        for (var level in levelFromName) {
            var probe;

            probes[levelFromName[level]] = probe =
                dtp.addProbe('log-' + level, 'char *');

            // Explicitly add a reference to dtp to prevent it from being GC'd
            probe.dtp = dtp;
        }

        dtp.enable();
    }

    // Helpers
    function addStream(s) {
github impromptu / impromptu / lib / server.js View on Github external
'use strict'

var net = require('net')
var fork = require('child_process').fork
var impromptu = require('../lib/impromptu')
var path = require('path')
var fs = require('fs')
var minimist = require('minimist')

var dtp = require('dtrace-provider').createDTraceProvider('impromptu')
dtp.addProbe('socket-connect', 'int')
dtp.addProbe('socket-end', 'int')
dtp.enable()

var argv = minimist(process.argv.slice(2), {
  defaults: {
    logfile: true,
    foreground: false
  },
  alias: {
    h: 'help',
    v: 'version'
  }
})

// If you use a Unix Domain Socket, its filename must be unique.
github auth0 / ad-ldap-connector / node_modules / passport-windowsauth / node_modules / ldapjs / node_modules / pooling / lib / pool.js View on Github external
function createDTraceProbes(name) {
        assert.string(name, 'name');

        if (DTPS[name]) {
                return (DTPS[name]);
        }

        var dtp = dtrace.createDTraceProvider(name);
        var probes = {
                // these are all object_id, state
                release: dtp.addProbe('release', 'int', 'json'),
                remove: dtp.addProbe('remove', 'int', 'json'),
                kill: dtp.addProbe('kill', 'int', 'json'),
                create: dtp.addProbe('create', 'int', 'json'),

                // additionally create_time of object
                acquire: dtp.addProbe('acquire', 'int', 'json', 'char *'),

                // additionally "ok"
                assert: dtp.addProbe('assert', 'int', 'json', 'int'),

                // just num_items to check and state
                check: dtp.addProbe('check', 'int', 'json'),
github joyent / node-workflow / lib / index.js View on Github external
function createDTrace(name) {
    // see https://github.com/mcavage/node-restify/issues/80 and
    // https://github.com/mcavage/node-restify/issues/100
    if (!DTRACE) {
        try {
            var d = require('dtrace-provider');
            DTRACE = d.createDTraceProvider(name);
        } catch (e) {
            DTRACE = {
                addProbe: function addProbe() {
                    var p = {
                        fire: function () {}
                    };
                    return (p);
                },
                enable: function enable() {},
                fire: function fire() {},
                removeProbe: function () {},
                disable: function () {}

            };
        }
    }
github avoidwork / turtle.io / lib / turtle.io.js View on Github external
value: function start(cfg, err) {
			var _this15 = this;

			var config = undefined,
			    headers = undefined,
			    pages = undefined;

			config = clone(defaultConfig);

			// Merging custom with default config
			merge(config, cfg || {});

			this.dtp = dtrace.createDTraceProvider(config.id || "turtle-io");

			// Duplicating headers for re-decoration
			headers = clone(config.headers);

			// Overriding default error handler
			if (typeof err === "function") {
				this.error = err;
			}

			// Setting configuration
			if (!config.port) {
				config.port = 8000;
			}

			merge(this.config, config);
github restify / clients / test / index.js View on Github external
function dtrace() {
    var dtp;

    try {
        var d = require('dtrace-provider');
        dtp = d.createDTraceProvider('restifyUnitTest');
    } catch (e) {
        dtp = null;
    }
    return (dtp);
}
github bahamas10 / node-dtrace-examples / static-probe-overhead / overhead_test2 / dtrace_looper.js View on Github external
/**
 *
 * This node app is used to test firing a probe while running dtrace vs no running dtrace
 * It will loop n times and fire a probe.  You time the test tracing with dtrace and testing without tracing.
 * When executing the app it will sleep 10s giving you a chance to start tracing with dtrace.
 *
 * Author: Michael Zeller 
 * Date: 4/23/12
 */

//number of times to loop
var n = 1000000

//setup dtrace probe
var dtp = require('dtrace-provider').createDTraceProvider('looper-test');
dtp.addProbe('looper-start', 'char *');
dtp.enable();

//function that will loop n times firing a dtrace probe.
function looper(text) {
  for ( var i = 0; i < n; i ++ ) {
  dtp.fire('looper-start', function () { return [text] });
  };
}

setTimeout(looper, 10000, "test looper");
github joyent / moray / lib / dtrace.js View on Github external
module.exports = function exportStaticProvider() {
    if (!PROVIDER) {
        PROVIDER = dtrace.createDTraceProvider('moray');

        PROVIDER._fast_probes = {};

        Object.keys(PROBES).forEach(function (p) {
            var args = PROBES[p].splice(0);
            args.unshift(p);

            var probe = PROVIDER.addProbe.apply(PROVIDER, args);
            PROVIDER._fast_probes[p] = probe;
        });

        PROVIDER.enable();
    }

    return (PROVIDER);
}();
github JonGretar / ResourceMachine / lib / dtrace.js View on Github external
module.exports = (function exportStaticProvider() {
	if (!PROVIDER) {
		try {
			var dtrace = require('dtrace-provider');
			PROVIDER = dtrace.createDTraceProvider('resource-machine');
		} catch (e) {
			PROVIDER = {
				fire: function () {},
				enable: function () {},
				addProbe: function () {
					var p = {
						fire: function () {}
					};
					return (p);
				},
				removeProbe: function () {},
				disable: function () {}
			};
		}
	}

dtrace-provider

Native DTrace providers for node.js applications

BSD-2-Clause
Latest version published 5 years ago

Package Health Score

74 / 100
Full package analysis