A work-in-progress OCaml SDK


#1

Hi,

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"


#2

Hi Brendan,

Great work! You might be interested in our new API design guidelines for SDKs, here: Unified SDK API
With two “reference implementations” being Python and .NET.

We were planning to officially announce both the new SDKs and the guidelines soon ™ (with more context about why we’re doing this), but given that you’re working on your own SDK it seems appropriate for you to know sooner. Feel free to post questions about the new API in https://forum.sentry.io/c/sdks/sdks-unified or ask on the issue trackers of the respective implementations.


#3

Thanks, I’ll take a look! I’ve been using the old SDK reference, which doesn’t say much about how the clients should be exposed. I’ll see if I can make it look more like those ones.