trail-agent

2.4.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i trail-agent

Weekly Downloads

0

Version

2.4.0

License

MIT

Last publish

Collaborators

  • cattail