@eggjs/tracer
v4.1.0
Published
tracer for egg
Readme
@eggjs/tracer
tracer plugin for egg.
Install
npm i @eggjs/tracerUsage
Enable tracer plugin:
// config/plugin.ts
import tracerPlugin from '@eggjs/tracer';
export default {
...tracerPlugin(),
};Build my own Tracer Class
// ./path/to/my_tracer.ts
import { Tracer } from '@eggjs/tracer';
const counter = 0;
export class MyTracer extends Tracer {
get traceId() {
return `${counter++}-${Date.now()}-${process.pid}`;
}
}Change the config to use MyTracer:
// config/config.default.ts
import { defineConfig } from 'egg';
import { MyTracer } from './path/to/my_tracer.ts';
export default defineConfig({
tracer: {
Class: MyTracer,
},
});Questions & Suggestions
Please open an issue here.
License
Contributors
Made with contributors-img.
