appsignal_phoenix v0.1.0 Appsignal.Phoenix.Channel

Instruments Phoenix channels.

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

instrument(module, name, socket, fun)

Link to this function

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

Link to this function

set_sample_data(span, socket)