elastic / elastic/apm-agent-python
[Agent-Python] AsyncIO + ThreadPool Span Tracing
- 主要言語
- Python
- スター
- 431
- フォーク
- 239
- 平均マージ
- 5日 10時間
- マージ済み PR(30日)
- 7
説明
**Describe the bug**:
Current setup: A flask endpoint that summons a sync function running asyncio code block and a threadpool executor that dovetails on the results of the asyncio code block
Looking for a way to monitor the function execution via the instrumentation of code running in those several threads.
- Both `@elasticapm.capture_span()` and `async_capture_span` were not able to trace the function execution as desired.
- Implemented the workaround suggested in #499 but did not work in my case.
Any advice/directions on this would be of great help. TIA.
**Environment (please complete the following information)**
- OS:
System Version: **macOS 10.14.6 (18G6020)**
Kernel Version: **Darwin 18.7.0**
- Python version: **3.8.0**
- Framework and version: **Flask 1.1.4**
- APM Server version: **7.6.2**
- Agent version: **6.4.0**
**Additional context**
Attaching a blueprint of the function block that gets triggered on hitting the flask request endpoint.

Essentially a bulk indexer job that posts to ES /_bulk endpoint post various data pre-processing.
On the APM front, only the request call/response duration is being captured by the agent:

Any advice/directions on this would be of great help. TIA.
コントリビューションガイド
調査の方向性
まず、報告された Python、Flask、agent のバージョンを使って、Flask エンドポイントの同期関数、asyncio ブロック、ThreadPoolExecutor のフローを再現します。capture_span と async_capture_span を #499 の回避策と比較し、span がリクエストだけでなく非同期処理とスレッド処理もカバーしていることを確認してください。この issue は、実装を完了と見なす前に、tracing のアプローチが確認されている必要があります。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- flask, python
- 領域
- backend, observability-sre
- issue の種類
- バグ
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 28/100