1.0.2 • Published 5 years ago

egg-simple-zipkin v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

egg-simple-zipkin

NPM version build status Test coverage David deps Known Vulnerabilities npm download

This plugin will apply a global middleware just behind bodyParser

and extend context with a global zipkin tracer

You could get the Tracer by ctx.zipkinTracer and share traceId among the request context

Install

$ npm i egg-simple-zipkin --save
# or
$ yarn add egg-simple-zipkin

Usage

// {app_root}/config/plugin.js
exports.simpleZipkin = {
  enable: true,
  package: 'egg-simple-zipkin'
}

Configuration

// {app_root}/config/config.default.js
exports.simpleZipkin = {
  ignorePaths: [],  // the middleware will ignore path in this array
  tracer: Tracer // you could pass in your CustomTracerInstance, and thus config below will be ignored
  recorder: 'console', // accept value ['console','batch']
  // if you choose consoleRecorder config below will be ignored
  httpRecorderOptions: {
    jsonEncoderVersion: 'V2', // accept value ['V1','V2']
    endpoint: 'localhost:1314/api/v2/spans', // zipkin endpoint
    httpInterval: 1000 // how often to sync spans. optional, defaults to 1000
  }
}

see config/config.default.js for more detail.

Example

Questions & Suggestions

Please open an issue here.

License

MIT