UNPKG

jstrace

Version:

dynamic tracing written in javascript (similar to dtrace/ktap etc)

25 lines (19 loc) 495 B
/** * This example shows how you can plot the distribution * of http response statuses over time. */ var clear = require('clear'); var bars = require('bars'); var m = {}; exports.local = function(traces){ traces.on('request:end', function(trace){ m[trace.status] = m[trace.status] || 0; m[trace.status]++; }); } setInterval(function(){ clear(); console.log(); console.log(bars(m, { bar: '=', width: 30 })); // m = {}; // optionally clear the bins each tick }, 1000);