Pprof
serves via its HTTP server fprof profiling data in the format expected by the pprof visualization tools for Elixir.
Pprof
basically uses erlang :fprof and generates meaningful pprof data from noisy data of fprof profile.
Hex documentation: Pprof
The observation and profiling culture of erlang and elixir is different from other languages. Elixir/Erlang runs on a virtual machine (a.k.a beam) and each block of code represents a process. Erlang provides many tools internally for monitoring abstracted processes and processes dependent functions. This library produces as meaningful pprof output as possible using the built-in Erlang profiling tools. Thus, it tries to spread the Erlang/Elixir observability with pprof-based ad-hoc profiling tools.
- This library an experimental and still under development, a library that needs to be careful to use on the production line.
- The accuracy of the outputs has been proven by testing with cross-tools. But this alpha version does not offer a full pprof service.
- fprof significantly slows down the application it is running on. It monitors all processes and collects their tracing data. Therefore, even a 10-second data collection in large-scale applications can mean GBs of data. It is recommended that the scrape seconds do not exceed 5 in order not to get lost in the abundance of data. More information: :fprof
def deps do
[
{:pprof, "~> 0.1.0"}
]
end
After:
$ mix deps.get
Add pprof config your config file like this:
config :pprof, :port, 8080
You can use with go pprof:
$ go tool pprof http://localhost:8080/debug/pprof/profile?seconds=5&type=fprof
Also using with Parca add configure in parca.yaml:
# params:
# type: [ 'fprof' ]
- :fprof support
- :eprof support
- :cprof support
- mapping support
- alloc endpoint
- heap endpoint
- processes monitoring(goroutine) endpoint
- building test env
- converting erlang stack
If you are an expert in elixir or erlang and want to contribute, please feel free. Who can say no to better written or more performant code? Thanks in advance for helping and teaching me so much.
pprof is released under the MIT License.