statetrace_elixir v0.1.1 StatetraceElixir.Annotations View Source
Schema for annotating database transactions for Statetrace.
Statetrace treats values written to statetrace_annotations in a special way,
allowing you to annotate the row-level transaction information. This should not be used
directly, instead you should use StatetraceElixir.Annotations
For information about integration see process_conn/2
Link to this section Summary
Functions
Annotate action information into the current database transaction.
Annotate session information into the current database transaction.
Generate the numerical portion of the frame's ID.
Annotates action information as part of process_conn/2
Processes a Plug.Conn
to annotate the current transaction with request details.
Annotates session information as part of process_conn/2
Link to this section Functions
Annotate action information into the current database transaction.
log_session!(repo, session_actor_id, session_actor_full_name, session_actor_avatar)
View SourceAnnotate session information into the current database transaction.
Generate the numerical portion of the frame's ID.
Annotates action information as part of process_conn/2
This function is exposed to give finer grained control over those who need it. In general it is recommended to use process_conn/2
Processes a Plug.Conn
to annotate the current transaction with request details.
This should be called inside of a transaction for example:
defmodule MyAppWeb.SomeController do
use MyAppWeb, :controller
alias StatetraceElixir.Annotations
def action(conn, _) do
args = [conn, conn.params]
with {_, response} <-
MyApp.Repo.transaction(fn ->
Annotations.process_conn(conn,
get_actor: fn conn -> conn.assigns.current_actor end,
repo: MyApp.Repo
)
apply(__MODULE__, action_name(conn), args)
end) do
response
end
end
end
Annotates session information as part of process_conn/2
This function is exposed to give finer grained control over those who need it. In general it is recommended to use process_conn/2