Open gautam-ergo opened 3 years ago
Hi @gautam-ergo! I experimented with patching ThreadPoolExecutor to make the transaction/span available in the executing thread a while ago in #705. I updated that branch just now to current master. If you have a test environment available, it would be great if you could give it a try by installing it like so:
pip install https://github.com/beniwohli/apm-agent-python/archive/refs/heads/thread-executor-support.zip\#egg\=elastic-apm\=\=100
Thanks and appreciate the prompt response @beniwohli , will try this out and post the results; just one clarification, do I instrument the code with begin_transaction
and end_transaction
in conjunction with capture_span
or is the flask's app level configuration just about enough to capture the info
The stock flask integration should be enough :+1:
Hey @beniwohli tried testing with the updated branch, APM is not able to pick up the trace info as expected, apm output is the same as the one I had posted earlier...not sure if i missed anything with the stock integration, any merit in trying the approach outlined in this repo's asyncio-tests
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.
@elasticapm.capture_span()
andasync_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)
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.