未验证 提交 eba453b1 编写于 作者: 天骄 提交者: GitHub

fix issue #134 (#135)

Co-authored-by: Nyangtianjiao <yangtianjiao@baidu.com>
上级 aafc18a0
...@@ -58,6 +58,7 @@ module.exports = function(httpModule, instrumentation, contextManager) { ...@@ -58,6 +58,7 @@ module.exports = function(httpModule, instrumentation, contextManager) {
function wrapEmit(original) { function wrapEmit(original) {
return function(event, req, res) { return function(event, req, res) {
if (event === "request") { if (event === "request") {
let originRes = res;
let contextCarrier = new ContextCarrier(); let contextCarrier = new ContextCarrier();
contextCarrier.fetchBy(function(key) { contextCarrier.fetchBy(function(key) {
if (req.headers.hasOwnProperty(key)) { if (req.headers.hasOwnProperty(key)) {
...@@ -75,7 +76,7 @@ module.exports = function(httpModule, instrumentation, contextManager) { ...@@ -75,7 +76,7 @@ module.exports = function(httpModule, instrumentation, contextManager) {
span.log(err); span.log(err);
} }
if (this.statusCode > 400) { if (originRes.statusCode > 400) {
span.errorOccurred(); span.errorOccurred();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册