amazon-web-services - Lambda Powertools Java - SegmentNotFound - @Tracing
问题描述
刚刚将 Lambda Powertools Java 添加到我的项目中,我已经用@Tracing
.
但是现在当我运行我的基本单元测试时,我收到一个错误“SegmentNotFound”。我想我可能能够在测试中创建一个片段,AWSXRay.beginSegment("handleRequest")
但不确定这是我应该做的。
TIA
解决方案
powertools 文档现已更新,在此处进行了解释。
本质上,您确实需要 beginSegment ,这可以通过几种不同的方式来实现。您可以通过以下方式避免噪音:
<!-- Configures environment variable to avoid initialization of AWS X-Ray segments for each tests-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<environmentVariables>
<LAMBDA_TASK_ROOT>handler</LAMBDA_TASK_ROOT>
</environmentVariables>
</configuration>
</plugin>
...在你的 pom 中。
推荐阅读
- webview - 颤抖的付款之旅
- ffmpeg - MP4 - 获取当前字幕文本
- hadoop - Hadoop返回的文件大小是否包括复制因子?
- jquery - 将 URL 复制到剪贴板脚本时出现未定义的错误消息
- angular - 如何使用angular2一次取消选中一个复选框
- c# - 从 C# 调用 C++ 方法时出现内存异常错误
- javascript - 节点包“node-rsa”的解密问题
- laravel - Laravel 关系通过模型:使其扁平化
- amazon-web-services - AWS Centos 6.9 和 6.10 AMI 是否支持 NVMe 和 ENA 驱动程序?
- datetime - 一般获取日期和时间