Installation
- The AppSignal instrumentation for Phoenix is part of a
separate package, which depends on the primary
appsignalpackage. Add theappsignal_phoenixpackage to yourmix.exsfile.
- Then run
mix deps.get. - Then run
mix appsignal.install YOUR_PUSH_API_KEY.
Channels
Channel instrumentation with a channel’s handle
Incoming channel requests can be instrumented by wrapping the code in yourhandle_in/3 functions with Appsignal.Phoenix.Channel.instrument/5:
LiveView
There are two different ways to instrument live views. You can either use our automatic telemetry handlers, or you can manually instrument your live view handlers with our helper functions.Automatic telemetry handlers
AppSignal’s LiveView Telemetry integration automatically instruments live view events. To set it up, callAppsignal.Phoenix.LiveView.attach/0 to attach the LiveView Telemetry handlers.
We recommend calling this function from your app’s application.ex:
mount, handle_event and handle_param events under the live_view namespace, meaning you’ll receive both performance and error insights into your live views.
Manual helper functions
A LiveView action can also be manually instrumented by wrapping its contents in aAppsignal.Phoenix.LiveView.instrument/4 block.
Given a live view that updates its own state every second, we can add
AppSignal instrumentation by wrapping both the mount/2 and handle_info/2
functions with a Appsignal.Phoenix.LiveView.instrument/4 call:
:live_view
namespace.