简体   繁体   English

AWS x射线未生成

[英]AWS x-ray not generating

I am trying to generate an x-ray using aws x-ray but it is not generating. 我正在尝试使用aws x射线生成x射线,但它没有生成。 Currently I am generating it for a lambda function in node.js 目前我正在为node.js中的lambda函数生成它

async function geUser(event, context) {

    await someFunction();
    const segment = new AWSXRay.Segment('getUser');
    segment.close();
    return 'success';
};

I have tried below example but still it's not generating 我试过下面的例子,但它仍然没有产生

async function getUser(event, context) {

    await someFunction();
    AWSXRay.captureFunc('annotations', function(subsegment){
        console.log('xraysubsegment', subsegment);
        subsegment.addAnnotation('LambdaFunction', 'getUser');
        subsegment.addAnnotation('UserID', id);
    });
    return 'success';
};

and in serverless.yml 在serverless.yml中

iamRoleStatements:
    - Effect: "Allow" 
      Action:
        - "xray:PutTraceSegments"
        - "xray:PutTelemetryRecords"
      Resource: "*"

Is there anything I am missing 有什么我想念的吗?

To use X-Ray in a Lambda function, you need to enable X-Ray for that Lambda function. 要在Lambda函数中使用X射线,您需要为该Lambda函数启用X射线。
In the console this is done under the "Debuggin and error handling configuration section", the configuration is called "Enable active tracing". 在控制台中,这是在“调试和错误处理配置部分”下完成的,配置称为“启用活动跟踪”。

See the documentation for further details. 有关详细信息,请参阅文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM