raven-erlang icon indicating copy to clipboard operation
raven-erlang copied to clipboard

don't try to generate frames for empty stacktrace

Open archydragon opened this issue 9 years ago • 4 comments

The last example from README tries to submit event to Sentry with empty stack trace and it triggers error at Sentry server side:

Discarded invalid value for interface: sentry.interfaces.Stacktrace
Traceback (most recent call last):
  File "/home/mayoi/tmp/sentry/src/sentry/coreapi.py", line 356, in validate_data
    inst = interface.to_python(value)
  File "/home/mayoi/tmp/sentry/src/sentry/interfaces/stacktrace.py", line 451, in to_python
    assert data.get('frames')
AssertionError

It doesn't influence Sentry functionality but just looks disgusting.

After this patch the only message appears in Sentry log in such cases:

Ignored empty interface value: sentry.interfaces.Stacktrace

archydragon avatar Jul 09 '15 15:07 archydragon

Even better would be to simply not send the stacktrace value at all (its not required)

dcramer avatar Jul 09 '15 18:07 dcramer

@dcramer that would be nice but as can be seen from the code, there is just lists:map/2 function to prepare Erlang structures for JSON encoding. The only alternative without adding additional case or if for checking stacktrace's emptiness is to send some dummy key like nostacktrace that won't be processed by Sentry anyway. Would it be better?

archydragon avatar Jul 13 '15 11:07 archydragon

You can also achieve the filtering with a lists:foldl or a list comprehension. On Mon 13 Jul 2015 at 13:20 Nikita K. [email protected] wrote:

@dcramer https://github.com/dcramer that would be nice but as can be seen from the code, there is just lists:map/2 function to prepare Erlang structures for JSON encoding. The only alternative without adding additional case or if for checking stacktrace's emptiness is to send some dummy key like nostacktrace that won't be processed by Sentry anyway. Would it be better?

— Reply to this email directly or view it on GitHub https://github.com/soundrop/raven-erlang/pull/15#issuecomment-120894479.

asabil avatar Jul 13 '15 12:07 asabil

I wouldn't want to add a dummy key to Sentry to work around simple client code. To be clear, I have no complaints about this change, just putting in my 2cents.

dcramer avatar Jul 13 '15 22:07 dcramer