JSPM

dtrace-express

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q31241F
  • License MIT

A dtrace library that implements express tracing

Package Exports

  • dtrace-express

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dtrace-express) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

dtrace-express

A library that implements dtrace for express.

It also includes a D script to output info in chrome tracing format to view response times visually.

install

% npm install express -S
% npm install express-tracer -S 
% npm install dtrace-express -S

usage

var express = require('express');
var expresstracer = require('express-tracer');
var dte = require('dtrace-express');

var app = express();
expresstracer(app);

// Add a middleware that fires at the start of a request.
app.use(dte.start);

// Add a route to show request traces.
app.get('/', function(req, res, next){
  res.trace('some.event', 'some event data');
  res.send('Hello world!');
  next();
});

// Add an after request processing middleware that runs trace.
app.use(dte.finish);


// Configure tracer.
app.instrument(dte.instrument);

app.listen(3000);
console.log('Express started on port 3000');ar dte = require('dtrace-express');

example

% node examples/index.js

In a seperate console as root run

# dtrace -s ./examples/chome-out.d > out.trc

Then open out.trc in the tracing tool embedded in chrome chrome://tracing