trace simple websocket messages - python
まだ誰も着手していません。
評価
調査の方向性
websocket.py で発生する接続失敗を再現します。特に、issue に示されている echo と begin_segment/begin_subsegment の呼び出しを確認してください。aws_xray_sdk.core.async_context.AsyncContext と、current_segment および get_trace_entity 周辺の recorder のコンテキストメソッドを読みます。クライアントが SegmentNotFoundException なしで websocket メッセージを交換でき、メッセージがトレースされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Hello XRay Team,
im having a project in python which uses websockets library. now we want to use xray to get some insights and i have to instrument it. as a starting point, i decided to set up a sample project to get to know xray, but it seems i cannot make it work.
when a client connects, im getting an error:
connection handler failed
Traceback (most recent call last):
File "/home/ec2-user/environment/projects/xray/websocket.py", line 25, in echo
subsegment = xray_recorder.begin_subsegment('process_message')
File "/home/ec2-user/.local/lib/python3.9/site-packages/aws_xray_sdk/core/recorder.py", line 313, in begin_subsegment
return self._begin_subsegment_helper(name, namespace)
File "/home/ec2-user/.local/lib/python3.9/site-packages/aws_xray_sdk/core/recorder.py", line 287, in _begin_subsegment_helper
segment = self.current_segment()
File "/home/ec2-user/.local/lib/python3.9/site-packages/aws_xray_sdk/core/recorder.py", line 271, in current_segment
entity = self.get_trace_entity()
File "/home/ec2-user/.local/lib/python3.9/site-packages/aws_xray_sdk/core/recorder.py", line 411, in get_trace_entity
return self.context.get_trace_entity()
File "/home/ec2-user/.local/lib/python3.9/site-packages/aws_xray_sdk/core/context.py", line 101, in get_trace_entity
return self.handle_context_missing()
File "/home/ec2-user/.local/lib/python3.9/site-packages/aws_xray_sdk/core/context.py", line 125, in handle_context_missing
raise SegmentNotFoundException(MISSING_SEGMENT_MSG)
aws_xray_sdk.core.exceptions.exceptions.SegmentNotFoundException: cannot find the current segment/subsegment, please make sure you have a segment open
#!/usr/bin/env python
import asyncio
from websockets.server import serve
from aws_xray_sdk.core.async_context import AsyncContext
from aws_xray_sdk.core import xray_recorder
# Configure the X-Ray recorder
xray_recorder.configure(
service='websocket',
context=AsyncContext(),
context_missing='RUNTIME_ERROR',
daemon_address='localhost:2000'
)
async def echo(websocket):
segment = xray_recorder.begin_segment('echo')
try:
async for message in websocket:
subsegment = xray_recorder.begin_subsegment('process_message')
try:
await websocket.send(message)
except Exception as e:
subsegment.add_exception(e)
finally:
xray_recorder.end_subsegment()
except Exception as e:
segment.add_exception(e)
finally:
xray_recorder.end_segment()
async def main():
async with serve(echo, "localhost", 8765):
await asyncio.Future() # run forever
asyncio.run(main())
what am i doing wrong?
- 主要言語
- Python
- スター
- 340
- フォーク
- 148
- 平均マージ
- 7日 8時間
- マージ済み PR(30日)
- 2
環境構築
- 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 が 22 日前に担当しました。 オープン
難易度 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 が 22 日前に担当しました。 オープン
難易度 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 件 ·
aws/aws-xray-sdk-python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
lidofinance/diffyscan#239 ·
メンテナーはふだん 1 日以内に返信
-
docs: the dev-setup table and AGENTS.md name the reviewed_by guard that CI's Changelog job runsオープンarea: tools documentation good first issue ready for a contributor
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
eyalgolan/statecraft-israel#873 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
GET rooms API returns 500 due to nonexistent Room.is_active attribute対応中かも @Mars-60 が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 5 日以内に返信
-
Harmony OPeNDAP SubSetter (HOSS) Geographic production rssmif16d 7 XYZ_PROV
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
nasa/harmony-autotester#341 ·