npm install koa-track
What can we do for you?
Are you having a hard time keeping track of what happened with a erroring flow?
Then this module if perfect for you. Generate a unique id that identifies a request and spread it along with subsequent requests to different services you might be using.
This way you can identify a flow and see what went wrong.
Use requestId middleware wherever you need to generate an id for an incoming request:
var koa = ;var koaTrack = ;var koaApp = ;var requestId = koaTrackrequestIdmiddleware;koaApp;
If you need to spread your tracking information to other servers you can do it with spread utility:
var http = ;var koaTrack = ;var spread = koaTrackspread;var self = this;// set up your http request options as usualvar requestOptions =hostname: "127.0.0.1"port: 3000path: "/user"method: "GET";// let spread function override options to embed current request idrequestOptions = ;// execute request as usualvar req = http;
How do I achieve a koa application reuse tracking information from a request?
var koaTrack = ;var middleware = koaTrackspread;koaApp;
Overriding default options for requestId middleware.