zipkin-instrumentation-miniapp-request

1.0.2 • Public • Published

zipkin-instrumentation-miniapp-request

基于 zipkin-instrumentation-fetchwx.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 ?

直接将打包好的文件放入小程序开发目录,使用相对路径进行引用

Zipkin.js

Readme

Keywords

none

Package Sidebar

Install

npm i zipkin-instrumentation-miniapp-request

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

61.6 kB

Total Files

7

Last publish

Collaborators

  • runjuu