aws x-ray tracing breaks on outgoing requests in N

2019-07-08 09:59发布

Hey I'm trying to trace outgoing requests from an express app, but I can't get it to work.

When I dont use the AWSXRAY.captureHttpsGlobal function everything works fine with incoming requests and I can see my application in "Service Map" and my incoming request traces coming in on AWS, but I want to trace outgoing requests and as soon as I add AWSXRAY.captureHttpsGlobal then nothing works and I get no exception or anything, and my Daemon doesnt print the usual "Successfully sent batch of 1 segments (0.058 seconds)"

This is my code.

var AWSXRay = require('aws-xray-sdk');
const express = require("express");

var app = express();
app.use(AWSXRay.express.openSegment('MyApp'));

AWSXRay.captureHTTPsGlobal(require('https')); // works when i comment this out
var http = require('https');


app.get('/', function (req, res) {
    http.get("https://google.com", (resp) => {
        res.send("googlefetched")
    });
    //res.send("hello world")

});

app.use(AWSXRay.express.closeSegment());
app.listen(3000, () => console.log('Example app listening on port 3000!'))

1条回答
该账号已被封号
2楼-- · 2019-07-08 11:02

could you share which node runtime version your code is running at and which X-Ray SDK version you are using so we can try to reproduce this issue on our side?

At the meantime I would like to share a previous issue that has been fixed since v1.2.0 https://github.com/aws/aws-xray-sdk-node/issues/18 where if the response body is not consumed then the entire segment will never be flushed to the daemon.

Please let me know.

查看更多
登录 后发表回答