Skip to content

Using inspect/2 with default options to print stacktrace info leads to limited printed output #332

@aghyad

Description

@aghyad

Environment

  • Elixir version (elixir -v): any
  • Erlang/OTP version (erl): any
  • Sentry version (mix deps): any
  • Operating system: any

Description

The current implementation of args_from_stacktrace/1 in Sentry.Event causes the output of inspects for stacktrace arguments to be limited and in a non-pretty format. This becomes obvious if your stacktrace is long and contains information you don't want omitted due to the default inspection limit.

:limit - limits the number of items that are printed for tuples, bitstrings, maps, lists and any other collection of items. 
It does not apply to strings nor charlists and defaults to 50. 
If you don't want to limit the number of items to a particular number, use :infinity.

Source: Inspect.Opts docs

Expected Behavior

To show the full stacktrace regardless of its size, and preferably in a beautiful format

Actual Behavior

Truncates the stacktrace by default due to inspect's default limitation, and for the same default settings of inspect, the stacktrace is not pretty-formatted

Steps to Reproduce

Try to log a long stack trace that surpasses inspect's limit stated in the docs referenced above, and you'll get the extra stackrace omitted

Suggested Fix

Explicitly, set the options of inspect/2 as:

limit: :infinity
pretty: true
structs: false
width: 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions