Plug actions registered as "unknown"

Affected components

  • AppSignal Elixir package versions: from v1.5.0-beta.1 - v1.13.x

Description

AppSignal groups performance and error samples by "action name". In Phoenix, we use the controller and action name (like AppsignalPhoenixExampleWeb.UserController#show). In pure Plug apps, it'd be best to fall back on the route name (like /users/:id), like we do for Sinatra apps in Ruby, but we can't currently get that data out of the Plug.Conn.

In versions before version 1.5.0-beta.1, Appsignal.Plug used the request method and the request path as the action name in plug-only apps. This caused problems for apps with unique URLs, as it creates a separate performance/error incident for each variation of the URL. To fix this, we're using "unknown" as the default action name in Plug apps, and we're allowing users to override that.

Workaround

To override the "unknown" action name, use Appsignal.Transaction.set_action/1 from anywhere within the action.

get "/users/:id" do
  Appsignal.Transaction.set_action("GET /users/:id")
  send_resp(conn, 200, "Welcome")
end

Want to help us improve this documentation page?

Create a pull request

Need more help?

Contact us and speak directly with the engineers working on AppSignal. They will help you get set up, tweak your code and make sure you get the most out of using AppSignal.

Contact us

Start a trial - 30 days free

AppSignal is a great way to monitor your Ruby, Elixir & Node.js applications. Works great with Rails, Phoenix, Express and other frameworks, with support for background jobs too. Let's improve your apps together.

Start a trial