SDK publishes exception segment regardless whether it's handled or not
@wangzlei 已经在做这个了。
开始于 2021年3月22日。
评估
这个 Issue 还没有评估数据。
描述
This was originally brought up in https://github.com/awslabs/aws-lambda-powertools-python/issues/334 but @heitorlessa mentioned this is could be an upstream issue here and asked me to file an Issue. The details can be found in the original issue as well but we have the following function in our lambda code:
def get_secrets(secret_name) -> dict:
try:
get_secret_value_response = client.get_secret_value(SecretId=secret_name)
except ClientError as e:
if e.response["Error"]["Code"] == "ResourceNotFoundException":
if "AWSCURRENT" in e.response["Message"]:
logger.warning(f"{secret_name} exists but is empty.")
else:
logger.warning(
f"The requested secret {secret_name} was not found. Create the secret first."
)
return {}
else:
raise RuntimeError("Couldn't retrieve secrets")
else:
return json.loads(get_secret_value_response["SecretString"])
And in our case we continue processing if the secret exists but a value hasn't been set. In this case we're catching and handling the exception, continuing execution. However, the SDK will still flag this as an exception in X-Ray which will show the service as erroring when it actually isn't.
The relevant line is at https://github.com/aws/aws-xray-sdk-python/blob/508f929fee495710656c0c1478f8873a2e9e5666/aws_xray_sdk/core/models/subsegment.py#L70-L78
Is there a way to handle this use case?
- 主要语言
- Python
- 星标
- 339
- 派生
- 147
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
aws/aws-xray-sdk-python 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 68/100
aws/aws-xray-sdk-python#490 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 1/100
aws/aws-xray-sdk-python#460 ·
-
Next release未关闭
难度 5/5 一周以上 新手友好度 20/100
aws/aws-xray-sdk-python#457 · 1 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 35/100
aws/aws-xray-sdk-python#453 ·
-
难度 4/5 3-5 天 新手友好度 35/100
aws/aws-xray-sdk-python#452 · 1 个 reaction ·
查看 aws/aws-xray-sdk-python 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
instance instance add
难度 2/5 1-3 小时 新手友好度 68/100
searxng/searx-instances#941 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 92/100
FluidNumerics/fluid-walk-blocker#89 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复