AppSignal v1.9.3 Appsignal.Instrumentation.Helpers View Source

Helper functions and macros to instrument function calls.

Link to this section Summary

Functions

Execute the given function in start / finish event calls in the current transaction. See instrument/6

Execute the given function in start / finish event calls. See instrument/6

Execute the given function in start / finish event calls. See instrument/6

Execute the given function in start / finish event calls

Link to this section Types

Link to this type

instrument_arg() View Source
instrument_arg() :: Appsignal.Transaction.t() | Plug.Conn.t() | pid() | nil

Link to this section Functions

Link to this function

instrument(name, title, function) View Source
instrument(String.t(), String.t(), function()) :: any()

Execute the given function in start / finish event calls in the current transaction. See instrument/6.

Link to this function

instrument(arg, name, title, function) View Source
instrument(instrument_arg(), String.t(), String.t(), function()) :: any()

Execute the given function in start / finish event calls. See instrument/6.

Link to this function

instrument(arg, name, title, body, function) View Source
instrument(instrument_arg(), String.t(), String.t(), String.t(), function()) ::
  any()

Execute the given function in start / finish event calls. See instrument/6.

Link to this function

instrument(pid, name, title, body, body_format, function) View Source
instrument(
  instrument_arg(),
  String.t(),
  String.t(),
  String.t(),
  integer(),
  function()
) :: any()

Execute the given function in start / finish event calls.

The result of the function's execution is returned. For example, to instrument a backend HTTP call in a Phoenix controller, do the following:

import Appsignal.Instrumentation.Helpers, only: [instrument: 4]

def index(conn, _params) do
  result = instrument "net.http", "Some slow backend call", fn() ->
    Backend.get_result()
  end
  json conn, result
end