Pretty graphs for traces
npm install traces-graph
|4||downloads in the last week|
|8||downloads in the last month|
|Version||0.2.0 last updated a year ago|
|Keywords||trace, traces, tracer, graph|
Customizable graphs for traces.
var Graph = require('trace-graph') , fs = require('fs'); // data would be from traces.get(cycle, fn) // in the "traces" module var graph = new Graph(data); // graph.barWidth(1); // graph.barSpacing(.5); // graph.barTip(1); // graph.max(graph.mean() + 100); // graph.max(3000); graph.barAlpha(.4); graph.scale(1, .12); graph.label('Image Uploads'); graph.color('request', '#b1daec'); graph.color('resize', '#8fcdec'); graph.color('save', '#4cb4ec'); graph.color('s3', '#1a9dec'); graph.draw(); fs.writeFileSync('out.png', graph.canvas.toBuffer()); console.log('saved out.png');
Initialize a new graph with the given
Clip the graph at a maximum of
ms. For example if a few traces
2000ms, and most are around
100ms you'll likely want to
150 or so to have a better view.
Scale the graph on the
y axis. For example if you have several hundred
thousand traces, representing them each as a single pixel on the x-axis will be
too large, you may want to try
.scale(.2, 1). Like-wise if the y-axis reaches
durations of several seconds, this equates to several thousands of pixels by default
unless a y-axis scale is applied such as
Set bar "tip" to
Set bar "width" to
Set bar "spacing" to
Set bar alpha to
color for probe
Draw the graph.
(The MIT License)
Copyright (c) 2012 LearnBoost <firstname.lastname@example.org>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.