-
Hello Memray community, For instance, in the link: https://bloomberg.github.io/memray/_static/flamegraphs/memray-flamegraph-fib.html
but in my case it's an FastAPI application which is up and running in production (we don't have SSH access to production machines hence using memray in the machines via terminal has to be ruled out in my case, and use API call via middleware to retrieve the flamegraph doc). Maybe we can use Linking a similar call stack profiler for reference - |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes, absolutely - you can use the tracker API from a middleware to capture a Memray capture file. We don't have an API for programmatically producing a flame graph from that capture file, but you can easily use subprocess.check_call([sys.executable, "-m", "memray", "flamegraph", "-o", flamegraph_html_file_name, capture_file]) and then you can read that HTML and deliver it to your FastAPI client as a response. |
Beta Was this translation helpful? Give feedback.
Yes, absolutely - you can use the tracker API from a middleware to capture a Memray capture file. We don't have an API for programmatically producing a flame graph from that capture file, but you can easily use
subprocess
for that part, e.g.,and then you can read that HTML and deliver it to your FastAPI client as a response.