I’ve been wanting to use Sentry with OCaml, and ended up writing my own library for it. I thought other people might be interested to, so:
It currently only works with Async and not Lwt or synchronous/stdlib only. If anyone else is interested, I’d definitely like to support those. And feedback would definitely be nice.
You basically just do this at the start of your program and it will load
SENTRY_DSN (and some other things) from your environment and upload any errors in the background:
Sentry.with_context @@ fun () ->
You can also set custom tags and upload exceptions or messages manually:
Sentry.with_environment "staging" @@ fun () -> Sentry.with_tags [ "method", "POST" ; "path", "/example" ] @@ fun () -> Sentry.capture_message "this will have the environment and tags above merged with the defaults"