如何将 AWS X-Ray 跟踪与 Amazon MQ 集成?
是否有办法跟踪 Amazon MQ 发送的消息?目前,我们有 API 获取请求并向另一个需要跟踪的应用程序发送消息。由于没有关于将 AWS X-Ray 集成到 Amazon MQ 的官方文档和支持,因此我们将不胜感激有关如何实现这一点的任何帮助
Is there anyway feasible to trace messages sent by Amazon MQ? Currently, we have API getting the request and sending a message to another application, which is needed to be traced. As there is no official documentation and support regarding the integration of AWS X-Ray into Amazon MQ, any help would be appreciated on how this can be implemented
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您能够自定义为 MQ 中的消息传播的标头,那么 X 射线跟踪将毫无问题地工作。
您需要让您的 AWS 服务能够按照本文档生成跟踪标头: 将 AWS X-Ray 与其他 AWS 服务集成
例如。对于 EC2 实例,您需要安装并运行 X-Ray 守护程序
然后,您需要将该 X-Ray 跟踪标头附加到 Amazon MQ 消息,以便应用程序 A 和 B 将成为同一跟踪的一部分,以了解更多信息有关跟踪标头,请查看此处: AWS X-Ray - 跟踪标头
通过这种方式,标头将传递到应用程序 A,然后应用程序 A 可以通过 Amazon MQ 将标头传播到应用程序 B。您应该使用 X 检测这两个服务-Ray SDK 解析跟踪标头并为每个服务创建一个段。
例如。要使用适用于 Node.js 的开发工具包,请查看此处 AWS X 射线:使用 Node.js
If you are able to customize headers that are propagated for messages in MQ, then the X-Ray tracing will works without issues.
You need to enable your AWS service to generate a trace header following this documentation: Integrating AWS X-Ray with other AWS services
eg. For a EC2 instance will you need to install and run the X-Ray daemon
Then, you will need to attach that X-Ray trace header to Amazon MQ messages so that Application A and B will be part of the same trace, to learn more about the trace header take a look here: AWS X-Ray - Tracing header
In this way, a header will be passed into the Application A, then Application A can propagate the header over Amazon MQ to Application B. You should instrument both services with the X-Ray SDK to parse the trace header and create a segment for each service.
Eg. To work with the SDK for Node.js take a look here AWS X-Ray: Working with Node.js