ERROR:aws_xray_sdk.core.context:cannot find the current segment/subsegment, please make sure you have a segment open
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- aws, python
調査の方向性
提供された generate_and_upload の再現コードから始め、特に xray_recorder.configure と s3_client.upload_file 周辺の in_segment コンテキストを確認します。Python 3.11.1 と aws-xray-sdk 2.14.0 で実行し、アップロード中およびクリーンアップ中にセグメントがどのように動作するかを調べます。アップロードが成功したままで、コンテキストエラーがなくなり、AWS X-Ray コンソールにセグメントが表示されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
``Hi,
I am experiencing an issue with the AWS X-Ray SDK for Python where segments are not being properly created or propagated, resulting in the following exception:
ERROR:aws_xray_sdk.core.context:cannot find the current segment/subsegment, please make sure you have a segment open
The file is being successfully being uploaded in my s3 bucket but the segment is not being traced.
Steps to Reproduce:
import json
import os
import boto3
from aws_xray_sdk.core import xray_recorder
from aws_xray_sdk.core import patch_all
import logging
from botocore.exceptions import NoCredentialsError, PartialCredentialsError
from aws_xray_sdk import global_sdk_config
from boto3.s3.transfer import TransferConfig
patch_all()
logging.basicConfig(level='ERROR')
logging.getLogger('aws_xray_sdk.core').setLevel(logging.ERROR)
.
.
.
.
def generate_and_upload(init, count):
session = boto3.Session(profile_name=aws_profile_name)
s3_client = session.client("s3")
# Create file path
file_path = os.path.join("generated", "data.json")
# Write data to the file
with open(file_path, "w") as file:
json.dump(
generate_json_document(init, count),
file,
separators=(",", ":"),
ensure_ascii=False,
)
xray_recorder.configure(service='data-generator')
with xray_recorder.in_segment('generate_and_upload') as segment:
trace_header = segment.trace_id
print(f"Trace Header: {trace_header}")
try:
trnasver_config = TransferConfig(max_concurrency=1)
s3_client.upload_file(
file_path,
f"{bucket}",
f"{path}",
ExtraArgs={"Metadata": {"X-Amzn-Trace-Id": trace_header}},
Config=trnasver_config,
)
print(
f"Uploaded"
)
finally:
xray_recorder.end_segment()
I tried to set os.environ['AWS_XRAY_SDK_ENABLED'] = 'false' and a dummy segment was created, but I am not able to see it in the AWS X-ray console.
I am using Python 3.11.1 and aws-xray-sdk is Version: 2.14.0
I have also tried to set off threading and also have 1 thread. The issue still exist,
@chanchiem
@luzfcb
@heitorlessa
- 主要言語
- Python
- スター
- 340
- フォーク
- 148
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
aws/aws-xray-sdk-python のほかの issue
-
psycopg connection context manager drops X-Ray tracing wrapper, so cursor execute calls are not traced対応中かも @reginaldalfret が 21 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
aws/aws-xray-sdk-python#490 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 1/100
aws/aws-xray-sdk-python#460 ·
-
Next releaseオープン
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
aws/aws-xray-sdk-python#457 · リアクション 1 件 ·
-
mysql-connector 9.2.0 - TypeError: 'MySQLConnection' object is not iterable対応中かも @reginaldalfret が 21 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
aws/aws-xray-sdk-python#453 ·
-
Bug: XRay SDK doesn't support pg8000 native driver再び着手できるかも @leandrodamascena が 634 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
aws/aws-xray-sdk-python#451 · コメント 2 件 · リアクション 1 件 ·
aws/aws-xray-sdk-python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
PolicyEngine/policyengine-us#10262 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
kellyjonbrazil/jc#788 ·
メンテナーはふだん 2 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
`/search.json` ignores the documented `editions.sort` parameter対応中かも @PranavD2905 が今日担当しました。 オープンAffects: Server Good First Issue Module: Solr Needs: Triage Theme: Public APIs Theme: Search
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
internetarchive/openlibrary#13989 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug P2: misleading query
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
jeffknupp/association#478 ·