NewRelic.Transaction (New Relic Elixir Agent v1.23.6) View Source
To enable Transaction reporting, you must instrument your Plug pipeline with a single line.
NewRelic.Transaction macro injects the required plugs to wire up automatic
Be sure to
use this as early in your Plug pipeline as possible to ensure the most
accurate response times.
defmodule MyApp do use Plug.Router use NewRelic.Transaction # ... end
To ignore reporting the current transaction, call:
Inside a Transaction, the agent will track work across processes that are spawned as
well as work done inside a Task Supervisor. When using
you can signal to the agent not to track the work done inside the Task, which will
exclude it from the current Transaction. To do this, send in an additional option:
Task.Supervisor.async_nolink( MyTaskSupervisor, fn -> do_work() end, new_relic: :no_track )
Link to this section Summary
Link to this section Functions
If you send a custom error response in your own
you MUST manually alert the agent of the error!
defmodule MyPlug do # ... use Plug.ErrorHandler def handle_errors(conn, error) do NewRelic.Transaction.handle_errors(conn, error) send_resp(conn, 500, "Oops!") end end