jvoegele/errata

Filter noise frames from captured stacktraces

已關閉

#49 建立於 2026年8月14日

 (0 則留言) (0 個反應) (0 位負責人)Elixir (1 個分叉)github user discovery
enhancementgood first issue

倉庫指標

星標
 (12 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Summary

create/1 captures the current stacktrace, and the top frames are Errata's own. Add an option to filter frames so the captured stacktrace starts at application code.

Motivation

The BEAM caps Process.info(self(), :current_stacktrace) at 8 frames by default. Errata drops one (the Process.info call itself) and keeps the rest, so a meaningful fraction of an already-short stacktrace can be Errata's own machinery rather than the application code that created the error. The frames a reader wants are the ones furthest from the library.

Splode has a :filter_stacktraces option taking atoms (exact module match) or strings (prefix match), with the rule that "for each consecutive sequence of frames matching any filter, only the deepest (last) frame is kept" — so a run of framework frames collapses to one rather than vanishing entirely, which keeps the trace honest.

Sketch

  • config :errata, filter_stacktraces: [MyApp.Repo, "Ecto."], applied in Errata.Env.new/2 where the stacktrace is captured.
  • Errata's own frames are the obvious default to filter, and doing that needs no configuration at all — it is strictly an improvement to what is captured today.
  • Splode's collapse-a-run-to-its-deepest-frame rule is worth copying rather than dropping matched frames outright; a stacktrace with silent holes is worse than a noisy one.

Worth pairing with the measurement recorded in #37: filtering happens after capture, so it does not change the cost, only the usefulness of what was captured. Trimming the depth of the capture, by contrast, buys nothing — the VM already caps it at 8.

Priority

Low. Small, self-contained, no API surface beyond one config key. Good candidate for a slow afternoon; the default-filter-Errata's-own-frames part could land on its own.

貢獻者指南