Appsignal.Phoenix.Channel (appsignal_phoenix v2.3.7)

Instruments Phoenix channels.

usage

Usage

To instrument a Phoenix channel, wrap the contents of your handle_in/3 function in an Appsignal.Phoenix.Channel.instrument/5 call:

defmodule AppsignalPhoenixExampleWeb.RoomChannel do
  use Phoenix.Channel

  def join("room:lobby", _message, socket) do
    {:ok, socket}
  end

  def join("room:" <> _private_room_id, _params, _socket) do
    {:error, %{reason: "unauthorized"}}
  end

  def handle_in("new_msg", %{"body" => body} = params, socket) do
    Appsignal.Phoenix.Channel.instrument(__MODULE__, "new_msg", params, socket, fn ->
      broadcast!(socket, "new_msg", %{body: body})
      {:noreply, socket}
    end)
  end
end

Link to this section Summary

Link to this section Functions

Link to this function

channel_action(module, name, socket, function)

Link to this function

instrument(module, name, socket, fun)

Link to this function

instrument(module, name, params, socket, fun)