Skip to content

eggjs/tracer

Repository files navigation

@eggjs/tracer

NPM version Test coverage Known Vulnerabilities npm download Node.js Version PRs Welcome CodeRabbit Pull Request Reviews

tracer plugin for egg.

Install

npm i @eggjs/tracer

Usage

Enable tracer plugin:

// config/plugin.js
exports.tracer = {
  enable: true,
  package: '@eggjs/tracer',
};

Build my own tracer

// my_tracer.js
const { Tracer } = require('@eggjs/tracer');

const counter = 0;

class MyTracer extends Tracer {
  get traceId() {
    return `${counter++}-${Date.now()}-${process.pid}`;
  }
}
module.exports = MyTracer;

Change the config to use MyTracer:

// config/config.default.js
exports.tracer = {
  Class: require('path/to/my_tracer.js'),
};

Questions & Suggestions

Please open an issue here.

License

MIT

Contributors

Contributors

Made with contributors-img.