RisingStack / trace-nodejs

Trace is a visualised distributed tracing platform designed for microservices.
https://trace.risingstack.com
Other
471 stars 90 forks source link

Where to import package #109

Closed yetithefoot closed 8 years ago

yetithefoot commented 8 years ago

As I understand trace wraps q and mongo somehow. Where should I require @risingstack/trace? How it works?

Before:

require('@risingstack/trace');
// before Q and mongojs
var fs = require('fs');
var Q = require('q');
var mongojs = require('mongojs');

or after:

var fs = require('fs');
var Q = require('q');
var mongojs = require('mongojs');
// after Q and mongojs
require('@risingstack/trace');
gergelyke commented 8 years ago

Hey, you should require it as the very first line of you application. Under the hood Trace patches the module system, so when you are require mongojs, this is when it will be instrumented.