getsentry/sentry-elixir

Document other options for capture_message/capture_exception

Closed this issue ยท 5 comments

๐Ÿ‘‹ Thanks for sentry,

right now both capure_message/2 and capture_exception/2 claim the following:

The opts argument is passed as the second argument to send_event/2.

This leaves you relatively confused as send_event/2 supports relatively few options.

For instance the README itself uses Sentry.capture_exception(my_exception, stacktrace: __STACKTRACE__) which isn't documented in there.

Some digging in the code reveals that the opts are split between client and event opts, the latter of which end up at some form of Event.create_event/1.

This includes some params I'd consider essential:

  • stacktrace
  • level
  • extra

These are hard to find now from the README & docs (at least I have completely missed them without digging into the code).

I think it'd be nice to either point people to the doc for the other function, or since it seems rather internal, document these options in another public facing common place so they're easier to find and adjust :)

I'm not PRing it, as I'm not sure where this should best live :)

@PragTob would it be enough if send_event/2 pointed to Event.create_event/1 for the rest of the options? Some options are specific to sending, and some to creating the event, so that's why they are split.

We can also update the README to point to send_event/2.

@whatyouhide I think that'd be helpful. As a full user experience for a client library I think it'd be better if all the (important) options were documented in one place - doing 3 hops to find all the options is a bit inconvenient. From a maintainer perspective I understand why it'd be preferred though ๐Ÿ˜…

The other thing for send_event/2 though is that iirc it doesn't do the splitting (capture_* does) which would make it slightly odd that the documentation about those lives with it (as it gets already handed a created event).

@savhappy wanna work on this?

Added some additional info in PR #778.

Thanks @PragTob for bringing this up!

Closing in favor of the PR.