I am trying to capture some spans in my Python Flask app using the decorator: @elasticapm.capture_span()
This works perfectly, until I execute a couple of functions in parallel using python's multiprocessing module. These spans are then never captured (the spans set in the main process are still captured). Within these functions, I am also not able to send an error or message (apm.capture_message()).
I use multiprocessing.Process and multiprocessing.Pipe to parallelize the execution of a list of functions.
I would love for each of these functions to be captured as individual spans within the request transaction.
Does anyone have experience with capturing parallel spans using Flask and Elastic APM?
unfortunately, this is not something we currently support. The information about ongoing transactions/spans is stored in a thread local (on Python 3.7 it's in a contextvar variable, but that amounts to to more or less the same thing in this case).
I will look into ways to achieve this, but it's a non-trivial problem and I can't say when we might support this use case.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.