Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Commit

Permalink
fix issue #134 (#135)
Browse files Browse the repository at this point in the history
Co-authored-by: yangtianjiao <yangtianjiao@baidu.com>
  • Loading branch information
TJ666 and yangtianjiao committed Sep 8, 2020
1 parent aafc18a commit eba453b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/nodejs-agent/lib/plugins/http/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ module.exports = function(httpModule, instrumentation, contextManager) {
function wrapEmit(original) {
return function(event, req, res) {
if (event === "request") {
let originRes = res;
let contextCarrier = new ContextCarrier();
contextCarrier.fetchBy(function(key) {
if (req.headers.hasOwnProperty(key)) {
Expand All @@ -75,7 +76,7 @@ module.exports = function(httpModule, instrumentation, contextManager) {
span.log(err);
}

if (this.statusCode > 400) {
if (originRes.statusCode > 400) {
span.errorOccurred();
}

Expand Down

0 comments on commit eba453b

Please sign in to comment.