Repository metrics
- Stars
- (12 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
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 inErrata.Env.new/2where 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.