Skip to content

Commit

Permalink
chore: add eflambe to dev dependencies (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
hauleth authored Jul 2, 2024
1 parent b0cf07f commit 179912e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ burrito_out/*
supavisor-*.tar.gz

priv/native/*
*.bggg
34 changes: 34 additions & 0 deletions docs/development/profiling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Profiling of the Supabase can be done using [eFlambé][eflambe] project.

Example profiling session looks like:

- Start application within IEx session (for example by using `make dev`)
- Within given session you can specify which function you want to trace, by
calling `:eflambe.capture({mod, func, arity}, no_of_caputres)`, however it is
useful to have some separate directory to store all traces, for that one can use
quick snippet

```elixir
dir = "./tmp/capture-#{DateTime.utc_now()}"; File.mkdir_p!(dir); :eflambe.capture({Supavisor.ClientHandler, :handle_event, 4}, 0, [output_directory: dir])
```

Which provides separate directory for each tracing session.
- Generated traces can be viewed in [Speedoscope][] for visual navigation.

![Speedoscope session example](/docs/images/trace-example.png)

### Problems to be resolved

- Currently you can monitor only function calls. Sometimes it would be handy to
monitor whole process instead, so it would provide better view into process work.
[Stratus3D/eflambe#47](https://github.com/Stratus3D/eflambe/issues/47)
- Currently if there is less than `no_of_captures` calls, then eFlambé will try
to wait for more calls indefinitely. There is no way to listen only for some
period and then just stop. [Stratus3D/eflambe#48](https://github.com/Stratus3D/eflambe/issues/48)
- You will not see arguments of called functions in traces, which mean that you
want to trace long running processes that have a lot of calls to similarly
named function (like `gen_statem` process) you will need some manual work to
find which clause matched given trace. [Stratus3D/eflambe#46](https://github.com/Stratus3D/eflambe/issues/46)

[eflambe]: https://github.com/Stratus3D/eflambe
[Speedoscope]: https://www.speedscope.app/
Binary file added docs/images/trace-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ defmodule Supavisor.MixProject do
{:plug_cowboy, "~> 2.5"},
{:joken, "~> 2.5.0"},
{:cloak_ecto, "~> 1.2.0"},
{:meck, "~> 0.9.2", only: :test},
{:meck, "~> 0.9.2", only: [:dev, :test]},
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
{:benchee, "~> 1.1.0", only: :dev},
Expand All @@ -66,6 +66,7 @@ defmodule Supavisor.MixProject do
{:cachex, "~> 3.6"},
{:inet_cidr, "~> 1.0.0"},
{:observer_cli, "~> 1.7"},
{:eflambe, "~> 0.3.1", only: [:dev]},

# pooller
# {:poolboy, "~> 1.5.2"},
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"distillery": {:hex, :distillery, "2.1.1", "f9332afc2eec8a1a2b86f22429e068ef35f84a93ea1718265e740d90dd367814", [:mix], [{:artificery, "~> 0.2", [hex: :artificery, repo: "hexpm", optional: false]}], "hexpm", "bbc7008b0161a6f130d8d903b5b3232351fccc9c31a991f8fcbf2a12ace22995"},
"ecto": {:hex, :ecto, "3.10.3", "eb2ae2eecd210b4eb8bece1217b297ad4ff824b4384c0e3fdd28aaf96edd6135", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "44bec74e2364d491d70f7e42cd0d690922659d329f6465e89feb8a34e8cd3433"},
"ecto_sql": {:hex, :ecto_sql, "3.10.2", "6b98b46534b5c2f8b8b5f03f126e75e2a73c64f3c071149d32987a5378b0fdbd", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.10.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.6.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.16.0 or ~> 0.17.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "68c018debca57cb9235e3889affdaec7a10616a4e3a80c99fa1d01fdafaa9007"},
"eflambe": {:hex, :eflambe, "0.3.1", "ef0a35084fad1f50744496730a9662782c0a9ebf449d3e03143e23295c5926ea", [:rebar3], [{:meck, "0.9.2", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm", "58d5997be606d4e269e9e9705338e055281fdf3e4935cc902c8908e9e4516c5f"},
"erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"},
"eternal": {:hex, :eternal, "1.2.2", "d1641c86368de99375b98d183042dd6c2b234262b8d08dfd72b9eeaafc2a1abd", [:mix], [], "hexpm", "2c9fe32b9c3726703ba5e1d43a1d255a4f3f2d8f8f9bc19f094c7cb1a7a9e782"},
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
Expand Down Expand Up @@ -84,4 +85,3 @@
"websock": {:hex, :websock, "0.5.3", "2f69a6ebe810328555b6fe5c831a851f485e303a7c8ce6c5f675abeb20ebdadc", [:mix], [], "hexpm", "6105453d7fac22c712ad66fab1d45abdf049868f253cf719b625151460b8b453"},
"websock_adapter": {:hex, :websock_adapter, "0.5.5", "9dfeee8269b27e958a65b3e235b7e447769f66b5b5925385f5a569269164a210", [:mix], [{:bandit, ">= 0.6.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "4b977ba4a01918acbf77045ff88de7f6972c2a009213c515a445c48f224ffce9"},
}

0 comments on commit 179912e

Please sign in to comment.