AppSignal v1.0.0 Appsignal.TransactionRegistry

Internal module which keeps a registry of the transaction handles linked to their originating process.

This is used on various places to link a calling process to its transaction. For instance, the Appsignal.ErrorHandler module uses it to be able to complete the transaction in case the originating process crashed.

The transactions are stored in an ETS table (with {:write_concurrency, true}, so no bottleneck is created); and the originating process is monitored to clean up the ETS table when the process has finished.

Summary

Functions

Given a process ID, return its associated transaction

Register the current process as the owner of the given transaction

Unregister the current process as the owner of the given transaction

Functions

lookup(pid, return_removed \\ false)
lookup(pid, boolean) :: Appsignal.Transaction.t | nil

Given a process ID, return its associated transaction.

register(transaction)
register(Appsignal.Transaction.t) :: :ok

Register the current process as the owner of the given transaction.

remove_transaction(transaction)
remove_transaction(Appsignal.Transaction.t) ::
  :ok |
  {:error, :not_found}

Unregister the current process as the owner of the given transaction.

start_link()
start_link :: {:ok, pid}