Bug: nested subsegments don't work across threads
@srprash ci sta già lavorando.
Dal 28/9/2023.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
We're tracking a bug where nested subsegments don't work across threads, even when using the official suggestion in the documentation.
We've managed to reproduce the issue with some minimal code:
Code snippet
from concurrent.futures import ThreadPoolExecutor
from aws_xray_sdk.core import xray_recorder
@xray_recorder.capture("## lambda handler")
def lambda_handler(event, context):
with ThreadPoolExecutor() as pool:
@xray_recorder.capture("## f")
def f():
@xray_recorder.capture("## h")
def h():
pass
def g(trace_entity):
xray_recorder.set_trace_entity(trace_entity)
h()
xray_recorder.clear_trace_entities()
curr = xray_recorder.get_trace_entity()
pool.submit(g, curr)
This produces the following XRay traces:
XRay trace
XRay Event at (2023-04-05T16:32:52.012000) with id (1-642d8694-731f0a1a6d204264677086db) and duration (0.388s)
- 0.388s - lambda-function-url-HelloWorldFunction-sRQB00cHvXOP [HTTP: 200]
- 0.021s - lambda-function-url-HelloWorldFunction-sRQB00cHvXOP
- 0.223s - Initialization
- 0.020s - Invocation
- 0.019s - ## lambda handler
- 0.018s - ## f
- 0.000s - ## h
- 0.000s - Overhead
The expected output would be for the "h" trace to be nested under "f":
Expected output
XRay Event at (2023-04-05T16:32:52.012000) with id (1-642d8694-731f0a1a6d204264677086db) and duration (0.388s)
- 0.388s - lambda-function-url-HelloWorldFunction-sRQB00cHvXOP [HTTP: 200]
- 0.021s - lambda-function-url-HelloWorldFunction-sRQB00cHvXOP
- 0.223s - Initialization
- 0.020s - Invocation
- 0.019s - ## lambda handler
- 0.018s - ## f
- 0.000s - ## h
- 0.000s - Overhead
- Lingua principale
- Python
- Stelle
- 339
- Fork
- 147
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di aws/aws-xray-sdk-python
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
aws/aws-xray-sdk-python#490 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 1/100
aws/aws-xray-sdk-python#460 ·
-
Next release Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
aws/aws-xray-sdk-python#457 · 1 reazione ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
aws/aws-xray-sdk-python#453 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
aws/aws-xray-sdk-python#452 · 1 reazione ·
Tutte le issue di aws/aws-xray-sdk-python
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
stephrobert/dsoxlab#238 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
sublimehq/package_control#1780 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
nwg-piotr/nwg-displays#145 ·