Trace Each Requests
Supported trace span list
All of the spands mentioned below are implemented and opened by default.
Span | Version | Desc |
---|---|---|
http(s).createServer() | - | All HTTP(S) Server, it also includes npm: koa, npm: express and etc |
http(s).request() | - | All HTTP(S) requests, it also includes npm: request, npm: urllib and etc |
npm: mongodb | >=2.2.x | it also includes ORM Based on mongodb, such as mongoose |
npm: mysql | ^2.x | it also includes ORM Based on mysql, such as sequelize |
npm: mysql2 | ^1.5 | - |
npm: ioredis | ^3.x | - |
Other requirements please create a Issue on GitHub.
How to view trace link
You can view it via Restful API
curl http://127.0.0.1:7002/trace?appName=my-site # my-site 是您的应用名
It can also be viewed through GUI Dashboard, check docs.
about sampling rate
Default sampling rate is:
{
rate: process.env.NODE_ENV !== 'production' ? 100 : 10,
// If the trace with the highest priority is out of the sample rate limit,
// such as a wrong trace.
priority: true
}
Production environment is 10%, otherwise 100%.
That can be changed via global config, docs.
How to add a new kind of spans
You can access all the interfaces about tracing via the single instance TraceManager object.
const {traceManager} = require('dorapan');
Get the current available tracer object via getCurrentTracer()
, like:
const tracer = traceManager.getCurrentTracer(); // If not in a trace link, will got a undefined
const span = tracer.startSpan('custom_span');
span.finish();
More please check API References:
- TraceManager
- Tracer
- The Tracer object extended and implemented OpenTracer, so please check it also.
Principle
TODO