andypearson
Feature Request: add Telemetry events for `assign_async`
Hey all,
I have been working on some performance improvements for the Phoenix application I work on.
As part of this, through trial and error I have discovered some very slow renders happening within assign_async in some of our dashboard screens. When the screens were implemented the performance was acceptable, but as the data behind the scenes has grown the time taken to render each part of the page has increased.
At the moment we are able to profile our performance using newrelic/elixir_agent, which uses the LiveView Telemetry events to collect transaction and span data.
However, unless I am missing something, the start and end of assign_async actually completing the work is not available to Telemetry.
My request is that the following new Telemetry events are added so that it’s possible to get visibility over assign_async:
[:phoenix, :live_view, :assign_async, :start][:phoenix, :live_view, :assign_async, :stop][:phoenix, :live_view, :assign_async, :exception]
These follow the existing naming conventions and would allow tools like the NewRelic agent to collection the associated timings.
I must admit I’m fairly new to a lot of this, so there may be a better way of doing what I want that already existing within LiveView.
There is an associated thread on GitHub where I have been talking with one of the maintainers of the NewRelic agent which may help with additional context: Problems getting metrics on LiveView async actions · Issue #550 · newrelic/elixir_agent · GitHub
Thanks for reading!
Most Liked
steffend
I think the approach shown by @rhcarvalho is a good solution. I’m not against adding telemetry events, but I’m hesitant because the async operations we have are assign_async, start_async and stream_async, and adding separate events for all three feels a bit much? But if we’d only have them for handle_async, it would also feel incomplete, although it would fit to other events being tied to callbacks (mount, handle_event). So yeah, maybe explicitly wrapping when necessary is the best approach for now.
lessless
Hey Andy!
This looks like a very welcome addition. Is there a chance that an issue in the LV repo would get a better attention to the matter?
rhcarvalho
This forum is the recommended venue for proposals like this. The GitHub issue tracker is used for bugs.
See
Popular in Proposals: Ideas
Other popular topics
Latest Phoenix Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security









