【问题标题】:aws x-ray tracing breaks on outgoing requests in Node.jsaws x 射线跟踪在 Node.js 中的传出请求上中断
【发布时间】:2018-05-10 18:42:04
【问题描述】:

嘿,我正在尝试跟踪来自 express 应用程序的传出请求,但我无法让它工作。

当我不使用 AWSXRAY.captureHttpsGlobal 函数时,传入请求一切正常,我可以在“服务地图”中看到我的应用程序,并且我的传入请求跟踪进入 AWS,但我想跟踪传出请求并尽快我添加了 AWSXRAY.captureHttpsGlobal 然后没有任何效果,我没有任何异常或任何东西,而且我的守护进程没有打印通常的“成功发送一批 1 段(0.058 秒)”

这是我的代码。

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!'))

【问题讨论】:

  • 嘿,你能更新你的工作代码吗?

标签: node.js amazon-web-services aws-xray


【解决方案1】:

您能否分享您的代码在哪个节点运行时版本以及您使用的 X-Ray SDK 版本,以便我们尝试在我们这边重现此问题?

与此同时,我想分享一个自 v1.2.0 https://github.com/aws/aws-xray-sdk-node/issues/18 以来已修复的先前问题,如果响应正文未被消耗,则整个段将永远不会刷新到守护程序。

请告诉我。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-20
    • 1970-01-01
    • 1970-01-01
    • 2018-01-19
    • 1970-01-01
    相关资源
    最近更新 更多