zipkin-instrumentation-miniapp-request
v1.0.2
Published
Zipkin instrumentation for WeChat Mini Programs
Downloads
4
Readme
zipkin-instrumentation-miniapp-request
基于 zipkin-instrumentation-fetch 将 wx.request 重新封装了一次
npm i zipkin-instrumentation-miniapp-request
例子 🌰
const { wrapRequest, zipkin } = require('zipkin-instrumentation-miniapp-request');
const {
Tracer,
BatchRecorder,
ExplicitContext,
HttpLogger
jsonEncoder: { JSON_V2 },
} = zipkin;
const tracer = new Tracer({
ctxImpl: new ExplicitContext(),
recorder: new BatchRecorder({
logger: new HttpLogger({
endpoint: 'http://localhost:9411/api/v2/spans',
jsonEncoder: JSON_V2,
})
}),
localServiceName: '小程序名称'
});
const zipkinRequest = wrapRequest({ tracer, serviceName: "小程序名称", remoteServiceName: "服务器名称" });
// zipkinRequest 使用方式和 wx.request 一样
无法使用 npm ?
直接将打包好的文件放入小程序开发目录,使用相对路径进行引用