View Source Sibyl.Handlers.FlameGraph (Sibyl v0.1.9)

An example Telemetry handler converting :telemetry events into Chrome-compatible flamegraphs.

Exposes two additional functions when compared to traditional Sibyl.Handlers:

  1. start/0 which instructs Elixir.Sibyl.Handlers.FlameGraph to start persisting metadata in order to build the resultant flamegraph.

  2. stop/1 which instructs Elixir.Sibyl.Handlers.FlameGraph to flush any captured metadata into a JSON file for further use.

If you're using a Chrome-derived browser, you'll be able to open and introspect generated flamegraphs via the Chrome Tracing builtin. Otherwise, you can use open source tools which understand Chrome Tracing's format to render graphs.

Examples of open source apps that can render Chrome Traces include Speedscope and Perfetto.

Note that this utility has only been tested and confirmed working with telemetry explicitly passed in via Sibyl and may not work when listening to arbitrary :telemetry events passed in from other OTP applications.

Notes on the file format used by Google's tracer, Speedscope, and other related tools can be found here.

Summary

Functions

Instructs Elixir.Sibyl.Handlers.FlameGraph to start capturing and persisting :telemetry metadata.

Returns true if Elixir.Sibyl.Handlers.FlameGraph has been started prior to invokation.

Instructs Elixir.Sibyl.Handlers.FlameGraph to output any captured :telemetry metadata into the JSON file of your choice.

Functions

@spec start() :: :ok

Instructs Elixir.Sibyl.Handlers.FlameGraph to start capturing and persisting :telemetry metadata.

@spec started?() :: boolean()

Returns true if Elixir.Sibyl.Handlers.FlameGraph has been started prior to invokation.

@spec stop(output_filepath :: Path.t()) :: :ok

Instructs Elixir.Sibyl.Handlers.FlameGraph to output any captured :telemetry metadata into the JSON file of your choice.