diff --git a/docs/development/profiling/README.md b/docs/development/profiling/README.md index ecbbc079ab..6a80d25f88 100644 --- a/docs/development/profiling/README.md +++ b/docs/development/profiling/README.md @@ -60,3 +60,21 @@ Having a flamegraph displayed is triggered by issuing the request with `pp=flame will show the flamegraph for that api request. The options available can be displayed by adding `pp=help` to a query. + +### API patch/post requests + +For bodied requests (e.g. patch/post) which typically are triggered not from a browser when profiling, a flamegraph can still be created, e.g.: + +`PATCH http://localhost:3000/api/v3/work_packages/1547?pp=async-flamegraph` + +will result in a flamegraph being created. Instead of appending `pp=flamegraph`, the appended parameter needs to be `pp=async-flamegraph`. + +But that flamegraph will not show up directly in the tools typically used. + +The flamegraph needs to be accessed by calling an arbitrary page of the application via the browser after having issued the bodied request (e.g. `http://localhost:3000`). In the lower right corner, sometimes after some waiting, the profiling tools will show a small menu from which the generated flamegraph can be accessed. + +![Flamegraph retrieval](flamegraph_retrieval.png) + +In case this fails, the flamegraphs are stored in `tmp/miniprofiler` in a file called `mp_timers_[some hash]`. Knowing which file belongs to the previously created flamegraph, the file can be opened by requesting: + +`http://localhost:3000/mini-profiler-resources/flamegraph?id=[some hash]` diff --git a/docs/development/profiling/flamegraph_retrieval.png b/docs/development/profiling/flamegraph_retrieval.png new file mode 100644 index 0000000000..bd7b0f79c0 Binary files /dev/null and b/docs/development/profiling/flamegraph_retrieval.png differ