简体   繁体   English

ECS fargate 没有出现在 xray 中

[英]ECS fargate doesn't show up in xray

So I have a kinesis consumer that is running in ECS fargate that I am trying to add on x-ray.所以我有一个在 ECS fargate 中运行的运动消费者,我试图在 X 射线上添加它。 I have added the x-ray side car to my CloudFormation for the task definition, and it shows up in the task and is running我已将 X 射线边车添加到我的 CloudFormation 以用于任务定义,它显示在任务中并正在运行

      {
        "name": "xray-daemon",
        "Image": {************.dkr.ecr.us-east-1.amazonaws.com/xray-daemon},
        "cpu": 32,
        "memoryReservation": 256,
        "portMappings" : [
          {
            "containerPort": 2000,
            "protocol": "udp"
          }
        ]
      },

I then put before and after an SNS publish然后我在 SNS 发布之前和之后

AWSXRay.beginSubsegment("SNS Publish")
-- do the publish
AWSXRay.endSubsegment();

And still no luck.仍然没有运气。

Finally, I added the following in the start of my app to, which I beleive, is logging the entire ECS process to x-ray最后,我在我的应用程序的开头添加了以下内容,我相信这是将整个 ECS 过程记录到 X 射线

    AWSXRayRecorderBuilder builder = AWSXRayRecorderBuilder.standard().withPlugin(new ECSPlugin())
    AWSXRay.setGlobalRecorder(builder.build())

So far, everything runs fine (consumer is unaffected, and running fine) but nothing is showing up in x-ray.到目前为止,一切运行良好(消费者未受影响,并且运行良好)但 X 射线未显示任何内容。 Any ideas on what I might be missing?关于我可能遗漏的任何想法?

Thanks谢谢

As you add this in your app:在您的应用程序中添加此内容时:

   AWSXRayRecorderBuilder builder = AWSXRayRecorderBuilder.standard().withPlugin(new ECSPlugin())
    AWSXRay.setGlobalRecorder(builder.build())

I'm not expert on aws but, you didn't miss that?我不是 aws 专家,但是,您没有错过吗?

Since Fargate is a service that manages the instances your tasks run on, access to the underlying host is prohibited.由于 Fargate 是一项管理任务运行实例的服务,因此禁止访问底层主机。 Consequently, the ECSPlugin and EC2Plugins for X-Ray will not work.因此,X-Ray 的 ECSPlugin 和 EC2Plugins 将不起作用。

If not, take a look on code snippet how you can add x-ray sdk to your app and run x-ray on fargate:如果没有,请查看代码片段,了解如何将 x-ray sdk 添加到您的应用程序并在 fargate 上运行 x-ray:

Sending tracing information to AWS X-Ray 将跟踪信息发送到 AWS X-Ray

You need to wrap your kinesis consumer's code in a segment to be able to see any of the trace data.您需要将运动消费者的代码包装在一个段中,以便能够看到任何跟踪数据。 Segment will denote your consumer as a node in the X-Ray service map. Segment 将您的消费者表示为 X-Ray 服务 map 中的一个节点。

https://github.com/aws/aws-xray-sdk-java#applications-not-using-javaxservlet-may-include-custom-interceptors-to-begin-and-end-trace-segments https://github.com/aws/aws-xray-sdk-java#applications-not-using-javaxservlet-may-include-custom-interceptors-to-begin-and-end-trace-segments

Use the AWSXRay.beginSegment and AWSXRay.endSegment APIs (similar to the subsegment APIs you're already using) to create a segment around the process.使用AWSXRay.beginSegmentAWSXRay.endSegment API(类似于您已经使用的子分段 API)围绕流程创建分段。 Subsegments require a segment to be present.子段需要存在一个段。 You're probably getting x-ray ContextMissing errors in your log while trying to create subsegment.在尝试创建子分段时,您的日志中可能会出现 X-ray ContextMissing错误。

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

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