Sentry.capture_message is async or not (sentry-elixir)?

Hi there. Do i need to wrap Sentry.capture_message in Task.async or is it already async by itself? To ensure no slowdown in production

I checked docs but didn’t find the answer.

1 Like

TL;DR: You don’t need to wrap it in a Task.async, It does that asynchronously for you by default.

Based on the code base, In Sentry.Client.send_event/2; the default behaviour for the result type is :none which is defined in the function documentation as follows:

:none sends the event from an unlinked
child process under Sentry.TaskSupervisor and will return {:ok, ""} regardless
of the result.

And you can see the in actual do_send_event/3 implementation that it calls Task.Supervisor.start_child to start a Task Supervisor that actually send the request.