Giter Club home page Giter Club logo

flame_on's Introduction

Flame On

Flame On - Phoenix LiveDashboard

Add Flame Graphs to your Phoenix Application or LiveDashboard

Getting Started

For more information on flame graphs and an introduction to Flame On, see the announcement blog post

Installation

Add :flame_on to your dependencies:

def deps do
  [
    {:flame_on, "~> 0.6.0"}
  ]
end

And then add Flame On as a LiveDashboard page or a LiveComponent in your LiveView page

Flame On as a LiveDashboard page

Modify the live_dashboard call in your Router:

live_dashboard "/dashboard",
  metrics: MyAppWeb.Telemetry,
  additional_pages: [
    flame_on: FlameOn.DashboardPage
  ]

You will now find a Flame On tab along the top of the LiveDashboard page

Flame On as a LiveComponent in your own LiveView page

<.live_component module={FlameOn.Component} id="flame_on" width="100%" height="100%" />

Usage

Choose the Module, Function, and Arity of the function you want to profile, click "Flame On", and then trigger the function (e.g. make a web request in a new tab). Note that for Elixir modules, you will need to prefix them with Elixir, e.g. Elixir.Phoenix.Controller, while Erlang modules take simply the erlang module name, e.g. cowboy_handler. The default values of cowboy_handler/execute/2 are the best way to capture a standard Phoenix Controller DeadView request or the DeadView request that kicks off a LiveView request.

Zooming

Clicking a block will zoom the flamegraph to that block and recalculate the percents for the blocks such that the clicked block is now 100%. You can return to a higher level block by clicking the link for it above the blocks.

Running in Production

Flame On should not be run in critical production environments. Flame On uses :meck under the hood. This swaps out beam code paths and injects mock code that includes tracing. If you do need to use Flame On in a critical production node to diagnose a specific issue, I recommend rebuilding or restarting that node after running it.

Running in a Release

:meck swaps out code paths and therefore you will need to include the beam files in your release. By default these are stripped, so in your release definition in mix.exs add the strip_beams: false flag:

releases: [
  my_app_web: [
    ...
    strip_beams: false
  ],

You may also need to explicitly include :meck as a dependency if it can't find it when trying to run in a release.

Credit

Credit to eFlambe for being the original capture engine used by Flame On and the inspiration for the current capture engine.

Authors

We are very thankful for the many contributors

Versioning

This library follows Semantic Versioning

Looking for help with your Elixir project?

At DockYard we are ready to help you build your next Elixir project. We have a unique expertise in Elixir and Phoenix development that is unmatched. Get in touch!

At DockYard we love Elixir! You can read our Elixir blog posts

Legal

DockYard, Inc. © 2022

@DockYard

Licensed under the MIT license

flame_on's People

Contributors

bcardarella avatar schrockwell avatar thefirstavenger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flame_on's Issues

PhoenixLiveView 0.19 & PhoenixLiveDashboard 0.8 breaking changes

After the yesterday's update to the Phoenix Live View and Phoenix Live Dashboard repositories, there is an issue when Flame On is compiled as a dependency in a project that utilizes the most recent versions of those repositories. This issue results in an error that halts the compilation process:

==> flame_on
Compiling 13 files (.ex)
warning: got "@impl Phoenix.LiveDashboard.PageBuilder" for function render_page/1 but this behaviour does not specify such callback. The known callbacks are:

  * Phoenix.LiveDashboard.PageBuilder.handle_event/3 (function)
  * Phoenix.LiveDashboard.PageBuilder.handle_info/2 (function)
  * Phoenix.LiveDashboard.PageBuilder.handle_params/3 (function)
  * Phoenix.LiveDashboard.PageBuilder.handle_refresh/1 (function)
  * Phoenix.LiveDashboard.PageBuilder.init/1 (function)
  * Phoenix.LiveDashboard.PageBuilder.menu_link/2 (function)
  * Phoenix.LiveDashboard.PageBuilder.mount/3 (function)
  * Phoenix.LiveDashboard.PageBuilder.render/1 (function)

  lib/flame_on/dashboard_page.ex:12: FlameOn.DashboardPage (module)

warning: function render/1 required by behaviour Phoenix.LiveDashboard.PageBuilder is not implemented (in module FlameOn.DashboardPage)
Warning:   lib/flame_on/dashboard_page.ex:1: FlameOn.DashboardPage (module)

warning: variable "f" does not exist and is being expanded to "f()", please use parentheses to remove the ambiguity or change the variable name
Warning:   lib/flame_on/component.html.heex:114: FlameOn.Component.render/1

warning: variable "f" does not exist and is being expanded to "f()", please use parentheses to remove the ambiguity or change the variable name
Warning:   lib/flame_on/component.html.heex:115: FlameOn.Component.render/1

warning: variable "f" does not exist and is being expanded to "f()", please use parentheses to remove the ambiguity or change the variable name
Warning:   lib/flame_on/component.html.heex:116: FlameOn.Component.render/1

warning: variable "f" does not exist and is being expanded to "f()", please use parentheses to remove the ambiguity or change the variable name
Warning:   lib/flame_on/component.html.heex:117: FlameOn.Component.render/1

warning: variable "f" does not exist and is being expanded to "f()", please use parentheses to remove the ambiguity or change the variable name
Warning:   lib/flame_on/component.html.heex:119: FlameOn.Component.render/1

warning: variable "f" does not exist and is being expanded to "f()", please use parentheses to remove the ambiguity or change the variable name
Warning:   lib/flame_on/component.html.heex:120: FlameOn.Component.render/1

warning: variable "f" does not exist and is being expanded to "f()", please use parentheses to remove the ambiguity or change the variable name
Warning:   lib/flame_on/component.html.heex:121: FlameOn.Component.render/1

warning: variable "f" does not exist and is being expanded to "f()", please use parentheses to remove the ambiguity or change the variable name
Warning:   lib/flame_on/component.html.heex:123: FlameOn.Component.render/1

warning: variable "f" does not exist and is being expanded to "f()", please use parentheses to remove the ambiguity or change the variable name
Warning:   lib/flame_on/component.html.heex:124: FlameOn.Component.render/1

warning: variable "f" does not exist and is being expanded to "f()", please use parentheses to remove the ambiguity or change the variable name
Warning:   lib/flame_on/component.html.heex:125: FlameOn.Component.render/1

warning: variable "f" does not exist and is being expanded to "f()", please use parentheses to remove the ambiguity or change the variable name
Warning:   lib/flame_on/component.html.heex:127: FlameOn.Component.render/1

warning: variable "f" does not exist and is being expanded to "f()", please use parentheses to remove the ambiguity or change the variable name
Warning:   lib/flame_on/component.html.heex:128: FlameOn.Component.render/1

warning: variable "f" does not exist and is being expanded to "f()", please use parentheses to remove the ambiguity or change the variable name
Warning:   lib/flame_on/component.html.heex:129: FlameOn.Component.render/1

warning: undefined function f/0 (expected FlameOn.Component to define such a function or for it to be imported, but none are available)
Warning:   lib/flame_on/component.html.heex:129

warning: undefined function f/0 (expected FlameOn.Component to define such a function or for it to be imported, but none are available)
Warning:   lib/flame_on/component.html.heex:128

warning: undefined function f/0 (expected FlameOn.Component to define such a function or for it to be imported, but none are available)
Warning:   lib/flame_on/component.html.heex:127

warning: undefined function f/0 (expected FlameOn.Component to define such a function or for it to be imported, but none are available)
Warning:   lib/flame_on/component.html.heex:125

warning: undefined function f/0 (expected FlameOn.Component to define such a function or for it to be imported, but none are available)
Warning:   lib/flame_on/component.html.heex:124

warning: undefined function f/0 (expected FlameOn.Component to define such a function or for it to be imported, but none are available)
Warning:   lib/flame_on/component.html.heex:123

warning: undefined function f/0 (expected FlameOn.Component to define such a function or for it to be imported, but none are available)
Warning:   lib/flame_on/component.html.heex:121

warning: undefined function f/0 (expected FlameOn.Component to define such a function or for it to be imported, but none are available)
Warning:   lib/flame_on/component.html.heex:120

warning: undefined function f/0 (expected FlameOn.Component to define such a function or for it to be imported, but none are available)
Warning:   lib/flame_on/component.html.heex:119

warning: undefined function f/0 (expected FlameOn.Component to define such a function or for it to be imported, but none are available)
Warning:   lib/flame_on/component.html.heex:117

warning: undefined function f/0 (expected FlameOn.Component to define such a function or for it to be imported, but none are available)
Warning:   lib/flame_on/component.html.heex:116

warning: undefined function f/0 (expected FlameOn.Component to define such a function or for it to be imported, but none are available)
Warning:   lib/flame_on/component.html.heex:115


== Compilation error in file lib/flame_on/component.ex ==
Error: ** (CompileError) lib/flame_on/component.html.heex:114: undefined function f/0 (expected FlameOn.Component to define such a function or for it to be imported, but none are available)

could not compile dependency :flame_on, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile flame_on", update it with "mix deps.update flame_on" or clean it with "mix deps.clean flame_on"
Error: Process completed with exit code 1.

In order to successfully compile the project, it is required to downgrade the versions of the Phoenix repositories to "0.18.18" for Phoenix Live View and "0.7.2" for Phoenix Live Dashboard.

Capture function calls on remote nodes

Hi 👋🏼

I have a question, I'm trying to run the flame_on on a remote node but it only enables trace on the local host.

  1. First run a dashboard on Node called live, attached the node my test node
  2. Visited dashboard on live instance and select test node.
  3. Started capturing to Elixir.IO.inspect/1
  4. Ran IO.inspect("hello") on test node.
  5. Got timeout

Screenshot 2022-02-28 at 14 24 52

If I do the same step but run the IO.inspect("hello") on live node, I get the 🔥 graphs.

Any suggestion or pointer on how can we fix that?

Module does not exist

Thank you for updating this lib to LiveView 0.18, trying it for the first time.

Somehow, some modules are not available thru Phoenix LiveDashboard while other are and working as expected.
From what i see there is nothing specific to the working on not found ones.

Any suggestions?

How to inspect a phoenix handle_message?

I can get flame_on to trigger on the default cowboy_handler, but I can't get it to trigger on basically anything else.

I've tried both erlang and elixir functions. I've looked at the beam file to see if the function names are mangled. No luck.

Can you or anyone else get it to work on phoenix liveview's handle_event? Does it work for anyone else?

Received unexpected trace event

I tried running flame_on with the default configuration with the live dashboard integration; however it just logs Received unexpcted trace event errors and the graphs never displays.

2022-02-24 08:15:01.450 [info] Received unexpected trace event: {:trace_ts, #PID<0.2865.0>, :gc_minor_start, [wordsize: 0, old_heap_block_size: 610, heap_block_size: 376, mbuf_size: 15, recent_size: 38, stack_size: 50, old_heap_size: 322, heap_size: 313, bin_vheap_size: 0, bin_vheap_block_size: 46422, bin_old_vheap_size: 69, bin_old_vheap_block_size: 46422], {1645, 712101, 450192}}
        (erl_level=info pid=<0.2866.0> )
2022-02-24 08:15:01.725 [info] Received unexpected trace event: {:trace_ts, #PID<0.2865.0>, :gc_minor_end, [wordsize: 304, old_heap_block_size: 610, heap_block_size: 610, mbuf_size: 0, recent_size: 15, stack_size: 50, old_heap_size: 331, heap_size: 15, bin_vheap_size: 0, bin_vheap_block_size: 46422, bin_old_vheap_size: 69, bin_old_vheap_block_size: 46422], {1645, 712101, 450213}}
        (erl_level=info pid=<0.2866.0> )
2022-02-24 08:15:01.740 [info] Received unexpected trace event: {:trace_ts, #PID<0.2865.0>, :gc_minor_start, [wordsize: 0, old_heap_block_size: 610, heap_block_size: 610, mbuf_size: 35, recent_size: 15, stack_size: 72, old_heap_size: 331, heap_size: 506, bin_vheap_size: 1, bin_vheap_block_size: 46422, bin_old_vheap_size: 69, bin_old_vheap_block_size: 46422], {1645, 712101, 477591}}
        (erl_level=info pid=<0.2866.0> )
2022-02-24 08:15:01.740 [info] Received unexpected trace event: {:trace_ts, #PID<0.2865.0>, :gc_minor_end, [wordsize: 357, old_heap_block_size: 610, heap_block_size: 987, mbuf_size: 0, recent_size: 177, stack_size: 72, old_heap_size: 338, heap_size: 177, bin_vheap_size: 1, bin_vheap_block_size: 46422, bin_old_vheap_size: 69, bin_old_vheap_block_size: 46422], {1645, 712101, 477635}}

...

Running an umbrella app with:

OS: Mac OS
Elixir: 1.13
Erland: 24.1.7
phoenix: 1.6.6
phoenix_live_dashboard 0.6.5
flame_on: 0.2.1

MFA validation does not work for remote nodes

When selecting another node in LiveDashboard, the validations for module/function/arity do not know how to introspect the exports on the non-local node, so the validations will fail if that MFA does not also exist on the local node.

As a workaround, if you define the MFA as a no-op in the local node, the validations will pass and the trace will start on the remote node. So, this does not appear to be a technical limitation, but just a limitation of the validations.

Trace server overloaded with traces of Jason.Decoder.string

As discussed in #18, we are experiencing an issue whereby some traces result in 800k+ entries being sent by :erlang.trace to our trace server. We were unable to determine when exactly this issue appeared. We downgraded a number of versions and the issue persisted on the project we could reliably reproduce it on, including Jason 1.4 -> 1.0.1, Erlang 25 -> 23. It is possible that this has always been an issue and we just never ran into it, but it is also possible that something in the LIveView upgrade either caused or exacerbated this issue.

"Flame on!" failed: function :erpc.call/4 is undefined (module :erpc is not available)

Error log:

** (UndefinedFunctionError) function :erpc.call/4 is undefined (module :erpc is not available)
    :erpc.call(:nonode@nohost, FlameOn.Capture.Server, :start, [%FlameOn.Capture.Config{arity: 2, function: :execute, module: :cowboy_handler, reply_to: {:live_component, #PID<0.1699.0>, :flame_on_component}, target_node: :nonode@nohost, timeout: 15000}])
    (flame_on 0.5.2) lib/flame_on/capture.ex:6: FlameOn.Capture.capture/1
    (flame_on 0.5.2) lib/flame_on/component.ex:133: FlameOn.Component.handle_event/3
    (phoenix_live_view 0.17.14) lib/phoenix_live_view/channel.ex:600: anonymous fn/4 in Phoenix.LiveView.Channel.inner_component_handle_event/4
    (telemetry 1.2.1) /home/angdi/Documents/workspace/Timber_Server/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
    (phoenix_live_view 0.17.14) lib/phoenix_live_view/diff.ex:206: Phoenix.LiveView.Diff.write_component/4
    (phoenix_live_view 0.17.14) lib/phoenix_live_view/channel.ex:523: Phoenix.LiveView.Channel.component_handle_event/6
    (stdlib 3.12.1) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib 3.12.1) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib 3.12.1) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: %Phoenix.Socket.Message{event: "event", join_ref: "5", payload: %{"cid" => 1, "event" => "capture_schema", "type" => "form", "value" => "capture_schema%5Bmodule%5D=cowboy_handler&capture_schema%5Bfunction%5D=execute&capture_schema%5Barity%5D=2&capture_schema%5Btimeout%5D=15000"}, ref: "7", topic: "lv:phx-F33SQhksgdR0xQAI"}
State: %{components: {%{1 => {FlameOn.Component, :flame_on_component, %{__changed__: %{}, capture_changeset: #Ecto.Changeset<action: nil, changes: %{arity: 2, function: "execute", module: "cowboy_handler", timeout: 15000}, errors: [], data: #FlameOn.Component.CaptureSchema<>, valid?: true>, capture_timed_out?: false, capturing?: false, flash: %{}, id: :flame_on_component, myself: %Phoenix.LiveComponent.CID{cid: 1}, root_block: nil, target_node: :nonode@nohost, view_block_path: [], viewing_block: nil}, %{__changed__: %{}, root_view: Phoenix.LiveDashboard.PageLive}, {64556191083986353407896411091332806182, %{0 => {305909518590041931035299644016833524426, %{3 => {146325164111897696367085898820576700261, %{}}}}}}}}, %{FlameOn.Component => %{flame_on_component: 1}}, 2}, join_ref: "5", serializer: Phoenix.Socket.V2.JSONSerializer, socket: #Phoenix.LiveView.Socket<assigns: %{__changed__: %{}, csp_nonces: %{img: nil, script: nil, style: nil}, flash: %{}, live_action: :page, menu: #Phoenix.LiveDashboard.PageLive<...>, page: %Phoenix.LiveDashboard.PageBuilder{allow_destructive_actions: false, info: nil, module: FlameOn.DashboardPage, node: :nonode@nohost, params: %{"page" => "flame_on"}, route: :flame_on, tick: 0}}, endpoint: TimberWeb.Endpoint, id: "phx-F33SQhksgdR0xQAI", parent_pid: nil, root_pid: #PID<0.1699.0>, router: TimberWeb.Router, transport_pid: #PID<0.1696.0>, view: Phoenix.LiveDashboard.PageLive, ...>, topic: "lv:phx-F33SQhksgdR0xQAI", upload_names: %{}, upload_pids: %{}}
:erpc

How should I fix this issue? Thanks!

Failing to read output files

When hitting the flame on button for the first time, it creates the directory flame_on_output_delete_me on the project root. After that first time, it doesn't capture anything, it only creates the directory. In the second run, it captures (added the example code to index.html) but at the end of the capture the directory and its contents are deleted and an exception is raised when trying to read the output file to, I assume, display the chart.

[error] Process #PID<0.1004.0> raised an exception
** (File.Error) could not read file "flame_on_output_delete_me/1646049518416906-eflambe-output.bggg": no such file or directory
    (elixir 1.13.0) lib/file.ex:355: File.read!/1
    (flame_on 0.2.1) lib/flame_on/capture.ex:30: FlameOn.Capture.watch_output_directory_loop/4

Here's a little trace to the console

... info about what is capturing ...
Successful finished trace
Output filename: flame_on_output_delete_me/1646049871010006-eflambe-output.bggg
[watch] build started (change: "..")
[debug] Live reload: priv/static/assets/app.js
[watch] build finished
[debug] Live reload: priv/static/assets/app.js
[debug] Live reload: priv/static/assets/app.js
[error] Process #PID<0.1095.0> raised an exception
** (File.Error) could not read file "flame_on_output_delete_me/1646049871010006-eflambe-output.bggg": no such file or directory
    (elixir 1.13.0) lib/file.ex:355: File.read!/1
    (flame_on 0.2.1) lib/flame_on/capture.ex:30: FlameOn.Capture.watch_output_directory_loop/4
[info] GET /dashboard/flame_on
[debug] Processing with Phoenix.LiveView.Plug.page/2
  Parameters: %{"page" => "flame_on"}
  Pipelines: [:admins_only, :browser]
[info] Sent 200 in 30ms

Support LiveView 0.18.X

Hello and thanks for the great project!

This issue is to track support for the latest release of phoenix_live_view, 0.18.18.

Currently, it is incompatible

Because your app depends on flame_on ~> 0.2 which depends on phoenix_live_view ~> 0.17.6, phoenix_live_view ~> 0.17.6 is required.
So, because your app depends on phoenix_live_view ~> 0.18.3, version solving failed.

GenServer :eflambe_server terminating

I tried to run the flame on the default cowboy_handler/execute/2 but it crashed on the following:

08:07:28.113 [info] Sent 200 in 182ms
08:07:28.164 [error] GenServer :eflambe_server terminating
** (stop) {:not_mocked, :cowboy_handler}
    c:/Users/simon/code/logacy/deps/meck/src/meck_proc.erl:491: :meck_proc.gen_server/3
    c:/Users/simon/code/logacy/deps/meck/src/meck.erl:484: :meck.unload/1
    (eflambe 0.2.2) c:/Users/simon/code/logacy/deps/eflambe/src/eflambe_server.erl:182: :eflambe_server.maybe_unload_meck/1
    (eflambe 0.2.2) c:/Users/simon/code/logacy/deps/eflambe/src/eflambe_server.erl:123: :eflambe_server.handle_call/3
    (stdlib 3.17) gen_server.erl:721: :gen_server.try_handle_call/4
    (stdlib 3.17) gen_server.erl:750: :gen_server.handle_msg/6
    (stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.1070.0>): {:stop_trace, #Reference<0.1415018814.67895297.38408>}
State: {:state, [{:trace, #Reference<0.1415018814.67895297.38408>, 1, 1, false, #PID<0.1073.0>, [meck: :cowboy_handler, output_directory: "flame_on_output_delete_me"]}]}
Client #PID<0.1070.0> is alive

    (stdlib 3.17) gen.erl:214: :gen.do_call/4
    (stdlib 3.17) gen_server.erl:243: :gen_server.call/3
    (eflambe 0.2.2) c:/Users/simon/code/logacy/deps/eflambe/src/eflambe.erl:125: :eflambe.stop_trace/1
    (eflambe 0.2.2) c:/Users/simon/code/logacy/deps/eflambe/src/eflambe.erl:54: anonymous fn/5 in :eflambe.capture/3
    c:/Users/simon/code/logacy/deps/meck/src/meck_code_gen.erl:178: :meck_code_gen.eval/5
    (cowboy 2.9.0) c:/Users/simon/code/logacy/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
    (cowboy 2.9.0) c:/Users/simon/code/logacy/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
    (stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
08:07:28.225 [error] Ranch protocol #PID<0.1070.0> of listener LogacyWeb.Endpoint.HTTP (connection #PID<0.1069.0>, stream id 1) terminated
an exception was raised:
    ** (ErlangError) Erlang error: {{{:not_mocked, :cowboy_handler}, [{:meck_proc, :gen_server, 3, [file: 'c:/Users/simon/code/logacy/deps/meck/src/meck_proc.erl', line: 491]}, {:meck, :unload, 1, [file: 'c:/Users/simon/code/logacy/deps/meck/src/meck.erl', line: 484]}, {:eflambe_server, :maybe_unload_meck, 1, [file: 'c:/Users/simon/code/logacy/deps/eflambe/src/eflambe_server.erl', line: 182]}, {:eflambe_server, :handle_call, 3, [file: 'c:/Users/simon/code/logacy/deps/eflambe/src/eflambe_server.erl', line: 123]}, {:gen_server, :try_handle_call, 4, [file: 'gen_server.erl', line: 721]}, {:gen_server, :handle_msg, 6, [file: 'gen_server.erl', line: 750]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 226]}]}, {:gen_server, :call, [:eflambe_server, {:stop_trace, #Reference<0.1415018814.67895297.38408>}, :infinity]}}
        (stdlib 3.17) gen_server.erl:247: :gen_server.call/3
        (eflambe 0.2.2) c:/Users/simon/code/logacy/deps/eflambe/src/eflambe.erl:125: :eflambe.stop_trace/1
        (eflambe 0.2.2) c:/Users/simon/code/logacy/deps/eflambe/src/eflambe.erl:54: anonymous fn/5 in :eflambe.capture/3
        (cowboy 2.9.0) c:/Users/simon/code/logacy/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
        (cowboy 2.9.0) c:/Users/simon/code/logacy/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
        (stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
        (cowboy 2.9.0) :cowboy_handler.execute(%{bindings: %{}, body_length: 0, cert: :undefined, has_body: false, headers: %{"accept" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8", "accept-encoding" => "gzip, deflate", "accept-language" => "en-AU,en-GB;q=0.8,en-US;q=0.5,en;q=0.3", "connection" => "keep-alive", "cookie" => "user_data=eyJoZXhfY29sb3IiOiIjRkE4MDcyIiwibmFtZSI6bnVsbH0=; _logacy_key=SFMyNTY.g3QAAAADbQAAAAtfY3NyZl90b2tlbm0AAAAYOXlkYS0yNk1hTmFKZVA1U1dUYXczSXRvbQAAAA5saXZlX3NvY2tldF9pZG0AAAA7dXNlcnNfc2Vzc2lvbnM6NnRzVmc2eFl4emQtQjBBUjZIeERQRFFsU3JPVnhhb0t3bFY4Vk1WY1ZtVT1tAAAACnVzZXJfdG9rZW5tAAAAIOrbFYOsWMc3fgdAEeh8Qzw0JUqzlcWqCsJVfFTFXFZl.zfZg-Q5NBRJ3tsUGGbevCv5uBnqdx-NBqofgjtvS7k8; _livebook_key=SFMyNTY.g3QAAAAEbQAAAAo4MDgwOnRva2VubQAAACAlIl8rH-oxpWcBD8OULBvXMw1phz6RxvAqAHhzjTzgiG0AAAALX2NzcmZfdG9rZW5tAAAAGDhXbU1yM19JRmh2c2JpeDlnTThaWEZJNG0AAAAPY3VycmVudF91c2VyX2lkbQAAACA2b3N6emxzc3Zwa3VheDVsYW1kem1obGl4N2U1dWZ0eW0AAAAJdXNlcl9kYXRhdAAAAAJtAAAACWhleF9jb2xvcm0AAAAHI0ZBODA3Mm0AAAAEbmFtZWQAA25pbA.5la-XDwBoQdrTtBtuGAFbdwn2Isnt2S1pA-ePEQzfN4", "dnt" => "1", "host" => "localhost:4000", "sec-fetch-dest" => "document", "sec-fetch-mode" => "navigate", "sec-fetch-site" => "none", "sec-fetch-user" => "?1", "sec-gpc" => "1", "upgrade-insecure-requests" => "1", "user-agent" => "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0"}, host: "localhost", host_info: :undefined, method: "GET", path: "/alarms/2022/2/1", path_info: :undefined, peer: {{127, 0, 0, 1}, 56849}, pid: #PID<0.1069.0>, port: 4000, qs: "", ref: LogacyWeb.Endpoint.HTTP, scheme: "http", sock: {{127, 0, 0, 1}, 4000}, streamid: 1, version: :"HTTP/1.1"}, %{dispatch: [{:_, [], [{:_, [], Phoenix.Endpoint.Cowboy2Handler, {LogacyWeb.Endpoint, []}}]}], handler: Phoenix.Endpoint.Cowboy2Handler, handler_opts: {LogacyWeb.Endpoint, []}})

This is running as iex.bat -S mix phx.server on Windows 11 with...

Erlang/OTP 24 [erts-12.2.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]

Elixir 1.13.3 (compiled with Erlang/OTP 22)

Dependency               Current  Latest  Status
benchee                  1.0.1    1.0.1   Up-to-date
cachex                   3.4.0    3.4.0   Up-to-date
con_cache                1.0.0    1.0.0   Up-to-date
credo                    1.6.3    1.6.3   Up-to-date
ecto_sql                 3.7.2    3.7.2   Up-to-date
esbuild                  0.4.0    0.4.0   Up-to-date
flame_on                 0.2.1    0.2.1   Up-to-date
floki                    0.32.0   0.32.0  Up-to-date
gen_smtp                 1.1.1    1.1.1   Up-to-date
gettext                  0.19.1   0.19.1  Up-to-date
heroicons                0.3.2    0.3.2   Up-to-date
jason                    1.3.0    1.3.0   Up-to-date
logger_file_backend_win  0.0.2    0.0.2   Up-to-date
magritte                 0.1.2    0.1.2   Up-to-date
map_diff                 1.3.4    1.3.4   Up-to-date
msgpax                   2.3.0    2.3.0   Up-to-date
nimble_parsec            1.2.2    1.2.2   Up-to-date
number                   1.0.3    1.0.3   Up-to-date
pbkdf2_elixir            1.4.2    2.0.0   Update not possible
phoenix                  1.6.6    1.6.6   Up-to-date
phoenix_ecto             4.4.0    4.4.0   Up-to-date
phoenix_live_dashboard   0.6.5    0.6.5   Up-to-date
phoenix_live_reload      1.3.3    1.3.3   Up-to-date
phoenix_live_view        0.17.7   0.17.7  Up-to-date
plug_cowboy              2.5.2    2.5.2   Up-to-date
postgrex                 0.16.2   0.16.2  Up-to-date
slugify                  1.3.1    1.3.1   Up-to-date
surface                  0.7.1    0.7.1   Up-to-date
swoosh                   1.6.3    1.6.3   Up-to-date
telemetry_metrics        0.6.1    0.6.1   Up-to-date
telemetry_poller         1.0.0    1.0.0   Up-to-date
timex                    3.7.6    3.7.6   Up-to-date
vapor                    0.10.0   0.10.0  Up-to-date

I tried calling it on the mount/3 function of a LiveView and it errored on:

** (FunctionClauseError) no function clause matching in IO.chardata_to_string/1
    (elixir 1.13.3) lib/io.ex:627: IO.chardata_to_string(nil)
    (elixir 1.13.3) lib/path.ex:467: Path.rootname/1
    (surface 0.7.1) lib/mix/tasks/compile/surface.ex:62: anonymous fn/2 in Mix.Tasks.Compile.Surface.get_colocated_assets/0
    (elixir 1.13.3) lib/enum.ex:2396: Enum."-reduce/3-lists^foldl/2-0-"/3
    (surface 0.7.1) lib/mix/tasks/compile/surface.ex:14: Mix.Tasks.Compile.Surface.run/1
    (mix 1.13.3) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
    (elixir 1.13.3) lib/enum.ex:1593: Enum."-map/2-lists^map/1-0-"/2
    (elixir 1.13.3) lib/enum.ex:1593: Enum."-map/2-lists^map/1-0-"/2
    (phoenix 1.6.6) lib/phoenix/code_reloader/server.ex:249: Phoenix.CodeReloader.Server.mix_compile/2
    (phoenix 1.6.6) lib/phoenix/code_reloader/server.ex:178: Phoenix.CodeReloader.Server.mix_compile/4
    (phoenix 1.6.6) lib/phoenix/code_reloader/server.ex:73: anonymous fn/3 in Phoenix.CodeReloader.Server.handle_call/3
    (phoenix 1.6.6) lib/phoenix/code_reloader/server.ex:286: Phoenix.CodeReloader.Server.proxy_io/1
    (phoenix 1.6.6) lib/phoenix/code_reloader/server.ex:71: Phoenix.CodeReloader.Server.handle_call/3
    (stdlib 3.17) gen_server.erl:721: :gen_server.try_handle_call/4
    (stdlib 3.17) gen_server.erl:750: :gen_server.handle_msg/6
    (stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

"Flame On" page not visible in LiveDashboard

Hi,

I've added flame_on as a dependency and added it to my router.ex:

live_dashboard "/dashboard",
        metrics: DaymarWeb.Telemetry,
        flame_on: FlameOn.DashboardPage

but after restarting the server, I still don't see the page on my LiveDashboard. When I try going directly to http://localhost:4000/dev/dashboard/flame_on I get

Phoenix.LiveDashboard.PageNotFound at GET /dev/dashboard/flame_on

unknown page "flame_on"

Versions of relevant deps:

{:flame_on, "~> 0.6.0"}
{:phoenix_live_view, "~> 0.20.1"},
{:phoenix_live_dashboard, "~> 0.8.2"},

Flame On does not display result

Hi, I'm testing flame_on on my local server but it doesn't display profiling result and it uses too much memory.

Dependencies

      {:phoenix, "~> 1.6"},
      {:phoenix_ecto, "~> 4.0"},
      {:phoenix_live_dashboard, "~> 0.6.5"},
      {:flame_on, "~> 0.3"},
      {:telemetry_metrics, "~> 0.4"},
      {:telemetry_poller, "~> 0.4"}

Environment

  • Macbook M1
  • Elixir: 1.13
  • Erlang: 24.1.4

It uses too much memory
Screen Shot 2022-03-17 at 10 52 01 AM

Capturing timeout
Screen Shot 2022-03-17 at 10 46 35 AM

Some strange output on console

[info] Received unexpected trace event: {:trace_ts, #PID<0.4454.0>, :return_to, {Jason.Encode, :map_naive_loop, 3}, {1647, 489616, 144705}}
[info] Received unexpected trace event: {:trace_ts, #PID<0.4454.0>, :return_to, {Jason.Encode, :map_naive_loop, 3}, {1647, 489616, 144706}}
[info] Received unexpected trace event: {:trace_ts, #PID<0.4454.0>, :gc_minor_start, [wordsize: 2, old_heap_block_size: 196650, heap_block_size: 28690, mbuf_size: 1168, recent_size: 187, stack_size: 155, old_heap_size: 81714, heap_size: 28534, bin_vheap_size: 105, bin_vheap_block_size: 46422, bin_old_vheap_size: 5583, bin_old_vheap_block_size: 46422], {1647, 489616, 145129}}
[info] Received unexpected trace event: {:trace_ts, #PID<0.4454.0>, :gc_minor_end, [wordsize: 28251, old_heap_block_size: 196650, heap_block_size: 28690, mbuf_size: 0, recent_size: 1354, stack_size: 155, old_heap_size: 81811, heap_size: 1354, bin_vheap_size: 12, bin_vheap_block_size: 46422, bin_old_vheap_size: 5619, bin_old_vheap_block_size: 46422], {1647, 489616, 145130}}
[info] Received unexpected trace event: {:trace_ts, #PID<0.4454.0>, :return_to, {Jason.Encode, :map_naive_loop, 3}, {1647, 489616, 145134}}
[info] Received unexpected trace event: {:trace_ts, #PID<0.4454.0>, :return_to, {Jason.Encode, :map_naive_loop, 3}, {1647, 489616, 145135}}
[info] Received unexpected trace event: {:trace_ts, #PID<0.4454.0>, :return_to, {Jason.Encode, :map_naive_loop, 3}, {1647, 489616, 145136}}

Do I miss any configuration to make it work?

Thanks

Rebuild underlying capture engine

This issue is to notify of and keep track of the upcoming rebuild of the underlying engine that powers Flame On.

Now that a larger number of people are starting to use Flame On, it is becoming apparent that there are issues when dealing with larger datasets. It works great with a basic generated Phoenix app and a basic page, but once you hit a certain size of request, eFlambe fails to complete and we have little or no visibility into, or control over, handling this from the Flame On side of things. This makes debugging or diagnosing the issues difficult or impossible.

Flame On uses eFlambe under the hood in a very brittle hands-off manner, because the design goals of eFlambe and Flame On aren't exactly in sync (eFlambe being designed to generate flamegraph files, and Flame On needing access to the data directly). A more efficient and cleaner approach is to implement the core capture mechanism inside Flame On directly, giving us much more control and visibility into it and any potential issues that arise in the future.

If you like what Flame On is doing, but are one of the ones who find it to simply fail in your use case, hold on, an improved engine is coming... soon™️.

Flameon performance

Thanks for the magnificent work done on flameon and my hat off to you for rapidly rectifying the liveview rendering.

But a quick question, does flameon still do not influence the benchmarking because i realize for some endpoints testing using API tools, it appears significantly faster without flameon. With flameon, the extra time taken can be a number of seconds.

If im wrong, please close this and I stand corrected.

Thanks.

Save flame_on results to a file

Hi!

Is there currently a way to store flame_on results as a file (maybe an svg) ?.

I know eflambe can do this, but I have not found anything related on the flame_on docs.

Thanks :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.