Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Segment context not propagated when `asyncio.run_in_executor` is used

オープン
#446 コメント 2 件 リアクション 5 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
aws, python

調査の方向性

README のスレッドプールでのトレース伝播に関する説明と、loop.run_in_executor とともに使用される AsyncContext のエントリーポイントから始めます。最小化された例を再現し、次に run_task が現在のセグメントを取得する方法を追跡し、伝播が自動の場合に、セグメント不足またはサブセグメント不足のメッセージなしで例が完了することを確認します。

索引モデルが issue の本文から書いたものです。

説明

(Minimised) Example code:

import asyncio

from aws_xray_sdk.core import xray_recorder
from aws_xray_sdk.core import patch_all
from aws_xray_sdk.core.async_context import AsyncContext

import boto3

xray_recorder.configure(service="Test app", sampling=False, context=AsyncContext())
patch_all()


def run_task():
    s3_client = boto3.client("s3")
    s3_client.list_buckets()


async def main():
    loop = asyncio.get_running_loop()
    xray_recorder.begin_segment("test")
    await loop.run_in_executor(None, run_task)
    xray_recorder.end_segment()


asyncio.run(main())

Output:

cannot find the current segment/subsegment, please make sure you have a segment open
No segment found, cannot begin subsegment s3.
cannot find the current segment/subsegment, please make sure you have a segment open
cannot find the current segment/subsegment, please make sure you have a segment open
No segment to end
cannot find the current segment/subsegment, please make sure you have a segment open

I understand from the README that when using a thread pool (which is the default executor), the trace entity needs to be manually propagated. Could it be propagated automatically?

I'm asking because in the use case I have, a 3rd party library I'm using is making the call so I couldn't patch the call sites easily.

主要言語
Python
スター
339
フォーク
148
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

aws/aws-xray-sdk-python のほかの issue

aws/aws-xray-sdk-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。