trail-agent
v2.4.0
Published
Distributed tracing agent for Node.js
Downloads
5
Readme
node-trail-agent
Distributed tracing agent for Node.js
Installation
npm install --save trail-agent
Usage
Install other instrument libraries
npm install --save trail-instrument-redis
Initialize agent
var agent = require('trail-agent')
agent.instrument(['trail-instrument-redis'])
agent.setRecorder((span) => {
console.log(span)
})
Record in anywhere else
var agent = require('trail-agent')
let span = agent.start()
setTimeout(() => {
span.setTag('key', 'value')
span.finish()
})
Instrument library
To instrument library, you should provide a module with
target
: indicate targeting module name.wrap(agent, module)
: method with trail-agent instance and target module as arguments, return wrapped module.unwrap()
: method to unwrap method wrapped bywrap()
, intention of this method is unwrap method in tests.
Common tags
- protocol
- host
- status
License
MIT