appsignal_plug v2.0.14 Appsignal.Plug

AppSignal's Plug instrumentation instruments calls to Plug applications to gain performance insights and error reporting.

Installation

To install Appsignal.Plug into your Plug application, use Appsignal.Plug in your application's router module:

defmodule AppsignalPlugExample do
  use Plug.Router
  use Appsignal.Plug

  plug(:match)
  plug(:dispatch)

  get "/" do
    send_resp(conn, 200, "Welcome")
  end
end

Link to this section Summary

Functions

Adds an :appsignal_name to the Plug.Conn, to overwrite the root Appsignal.Span's name.

Link to this section Functions

Link to this function

put_name(conn, name)

Adds an :appsignal_name to the Plug.Conn, to overwrite the root Appsignal.Span's name.

Examples

iex> Appsignal.Plug.put_name(%Plug.Conn{}, "AppsignalPlugExample#index")
%Plug.Conn{private: %{appsignal_name: "AppsignalPlugExample#index"}}

In a Plug app, call Appsignal.Plug.put_name/2 on the returned Plug.Conn struct:

defmodule AppsignalPlugExample do
  use Plug.Router
  use Appsignal.Plug

  plug(:match)
  plug(:dispatch)

  get "/" do
    conn
    |> Appsignal.Plug.put_name("AppsignalPlugExample#index")
    |> send_resp(200, "Welcome")
  end
end