raven-erlang
raven-erlang copied to clipboard
don't try to generate frames for empty stacktrace
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
Even better would be to simply not send the stacktrace value at all (its not required)
@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?
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.
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.