Telemetry integration helpers for Threadline.
Threadline emits three telemetry events:
[:threadline, :transaction, :committed]— after anAuditTransactionis committed. Automatically emitted (withtable_count: 0) whenThreadline.record_action/2succeeds. For accurate per-transaction counts, callThreadline.Telemetry.transaction_committed/2explicitly after a known DB transaction commit.[:threadline, :action, :recorded]— afterThreadline.record_action/2completes (success or failure).[:threadline, :health, :checked]— afterThreadline.Health.trigger_coverage/1returns.
Usage
Attach handlers in your application's start/2 callback:
:telemetry.attach(
"my-app-audit",
[:threadline, :action, :recorded],
&MyApp.Instrumentation.handle_event/4,
nil
)
Summary
Functions
Emits [:threadline, :transaction, :committed] with the given table count.
Functions
Emits [:threadline, :transaction, :committed] with the given table count.
Call this after a DB transaction that you know produced AuditTransaction
records, when you need accurate table_count measurements.
Example
{:ok, txn} = MyApp.Repo.transaction(fn ->
# ... your writes ...
end)
Threadline.Telemetry.transaction_committed(txn, table_count: 3)