peaksnail / pinpoint-node-agent

pinpoint agent for nodejs
Apache License 2.0
75 stars 26 forks source link

axios插件 #30

Open CHENTIANHAO123 opened 6 years ago

CHENTIANHAO123 commented 6 years ago

你好,请问我要开发一个axios插件的话需要哪些步骤呢? 多谢!!!

peaksnail commented 6 years ago

https://github.com/peaksnail/pinpoint-node-agent/wiki/Pinpoint-node-agent-Plugin-Developer-Guide

CHENTIANHAO123 commented 6 years ago

@peaksnail 你好,博主,我刚学node.js 按照我的理解,axios的插件应该和https的插件差不多,如果https抓取的api是'https.get': '','https.request': '','https.createServer.requestListener': '' , 那么axios应该抓取哪些呢?可否再指点一下, 感谢回答,谢谢。。

peaksnail commented 6 years ago

抱歉,没接触过这个包,你需要阅读相关源码,知道底层调用的是哪个函数,然后对该函数开发插件。 比如 axios.request(‘http://www.baidu.com’). 你可以对request函数进行开发插件,或者阅读该函数的实现,看是否底层是一个通用的函数实现,对该底层函数进行开发插件

CHENTIANHAO123 commented 6 years ago

我现在卡在 了 axios 的回调函数那里了,如何在 axios的回调函数中 结束spanEvenRecord呢,求助攻啊,摆脱🙏。。。

CHENTIANHAO123 commented 6 years ago

额,应该是 axios的回调函数如何设置代理?

peaksnail commented 6 years ago

参考例子 中 sample2 实现, 回调函数本质上也是函数,和一般函数处理起来一样。

CHENTIANHAO123 commented 6 years ago

axios.get('http://10.20.22.206:8082/ppTestC/helloB').then(function(response){ //console.log(response); });

axios 的回调函数 不是 作为参数存在,它在外面,代理不到这个。。。,能加下你的微信么,我向您请教一下。。