Threadline.Telemetry (Threadline v0.2.0)

Copy Markdown View Source

Telemetry integration helpers for Threadline.

Threadline emits three telemetry events:

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

transaction_committed(transaction, opts \\ [])

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)