Closed jiaojiaojiao closed 7 years ago
There is no 'error' event for response! You should edit like below
var response = new Stream();
response.on('error', function (err) {
console.log(err);
})
process.nextTick(function () {
response.emit('error', new Error('test'));
});
And it works well.
thank you ! but I still have a problem,the problem is when I can't access REDIES for data,it will back to send HTTP request data, and this function is agent,This time will throw an exception,as follow:
e:\work\git\node-project\nodejs-employer-security-web-old\node_modules\bluebird\js\release\async.js:61
fn = function () { throw arg; };
Error: No context available. ns.run() or ns.bind() must be called first.
Unsupported Modules async: node agent can not work in async is mean that?
Whether the agent will trace data if the redis works well?
As before testing the agent with async,this error will happen ,because it can not get the context in async
In view of the asynchronous problem, whether can be solved?
pinpoint node agent use continuation-local-storage(cls) to get the context.If it doesn't work, you pass traceContext to next callback or function with its arguments .
对了,我看你们的项目是使用bluebird,我们内部的项目也是用bluebird,目前 node agent工作正常。 报的cls错误,应该是 当前函数获取上下文失败。可以再调试下具体的插件,看是否是traceContext初始化 有问题(从错误栈看出来)
2016-11-04 10:07 GMT+08:00 jiaojiaojiao notifications@github.com:
In view of the asynchronous problem, whether can be solved?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/peaksnail/pinpoint-node-agent/issues/6#issuecomment-258327277, or mute the thread https://github.com/notifications/unsubscribe-auth/ABqe33FeFgjvwTLW7oMOh2el2YOo7ej2ks5q6pNcgaJpZM4KiIIj .
可以看下TraceContext初始化的实现,如果无法获取当前上下文的话,会重新初始化,对于不支持Async模块,是有以下的现象: 一次请求过来 在 Async中中断,然后产生多个traceContext,从而有多个记录。所以可能是TraceContext初始化的时候有问题
thanks,原因就是async的时候中断了
in warp.js
it will catch Error: let my app done
Unsupported Modules async: node agent can not work in async is mean that?