Skip to content
Distributed tracing agent for Node.js
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
resources
src
.babelrc
.editorconfig
.eslintignore
.eslintrc.js
.gitignore
.istanbul.yml
.travis.yml
History.md
LICENSE
Readme.md
package.json

Readme.md

node-trail-agent NPM version build status Test coverage

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 by wrap(), intention of this method is unwrap method in tests.

Common tags

  • protocol
  • host
  • status

License

MIT

You can’t perform that action at this time.