# Work-in-progress Sentry SDK

**URL:** <https://discuss.ocaml.org/t/work-in-progress-sentry-sdk/2403>\
**Category:** Community\
**Tags:** announce\
**Created:** [August 6, 2018, 10:16pm UTC](https://discuss.ocaml.org/t/work-in-progress-sentry-sdk/2403 "2018-08-06T22:16:43Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![BrendanLong](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/brendanlong/32/522_2.png) [@BrendanLong](https://discuss.ocaml.org/u/BrendanLong)\
**Post date:** [August 6, 2018, 10:16pm UTC](https://discuss.ocaml.org/t/work-in-progress-sentry-sdk/2403/1 "2018-08-06T22:16:43Z")

</div>

Cross-posted-ish from: [https://forum.sentry.io/t/a-work-in-progress-ocaml-sdk/4406](https://forum.sentry.io/t/a-work-in-progress-ocaml-sdk/4406)

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:

> **[brendanlong/sentry-ocaml](https://github.com/brendanlong/sentry-ocaml)**
>
> A work-in-progress OCaml client for Sentry. Contribute to brendanlong/sentry-ocaml development by creating an account on GitHub.

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:

```auto
Sentry.with_context @@ fun () ->

```

You can also set custom tags and upload exceptions or messages manually:

```auto
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"

```

Results look like:

 ![](https://us1.discourse-cdn.com/flex020/uploads/ocaml/original/2X/4/40293449c4e632c7e7e6d4f55e7ced6bd8702976.png)

Note that it works a lot better if you use exceptions and not `Or_error.t`, although if someone wants to improve the `Or_error.t` parsing, pull requests would be welcome for that too.

---

_[View the full topic](https://discuss.ocaml.org/t/work-in-progress-sentry-sdk/2403)._
