0.0.7 • Published 6 years ago

zhike-zipkin-frontend v0.0.7

Weekly downloads
34
License
-
Repository
-
Last release
6 years ago

zipkin前端组件

to-do list

  • fetch支持
  • axios支持

配置

config = {
    serviceName: String // 服务名称
}

// 示例
const tracingConfig = {
  serviceName: "browser"
}

使用示例

安装

npm i zhike-zipkin-frontend

示例代码

Fetch

const {wrapFetch} = require('zhike-zipkin-frontend');
const zipkinFetch = wrapFetch({serviceName: 'browser'})(fetch);

zipkinFetch('http://localhost:8081/')
  .then(response => (response.text()))
  .then(text => log(text))
  .catch(err => log(`Failed:\n${err.stack}`));

Axios

import { wrapAxios } from 'zhike-zipkin-frontend';
const zipkinAxios = wrapAxios({
  zipkinServiceUrl,
  serviceName: 'USKid-browser',
})({ request: axios });

常规用法:
zipkinAxios.get('http://localhost:8081/')
  .then(response => (response.text()))
  .then(text => log(text))
  .catch(err => log(`Failed:\n${err.stack}`));


zipkinAxios.get === axios.get;
zipkinAxios.put === axios.put;
zipkinAxios.post === axios.post;
zipkinAxios.del === axios.del;
zipkinAxios.sendRequest(url, config) === axios(config);
0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago