A package for sentry.io integration - looking for testers

A little while ago I wrote a package SentryIntegration.jl to interface with Sentry (https://sentry.io) and I wanted to let people know of it in case it helps others and to get some feedback.

A quick description on Sentry: it is primarily for production environments where monitoring of issues is both essential and clunky. Sentry allows for errors to be quickly bubbled up and acted on. Two simple examples of usage in our company:

  • A generic “catch-all” of any unhandled exception can produce a email to relevant developers + a message in the developers channel of our slack chat.
  • We use it with a service that runs after modifications to the database to check for errors in our data structure.

A while ago, I wrote a websocket server for use in our company to answer database queries and decided to use Julia. It worked out very well and I’m pleased to have taken the plunge there.

We have Sentry integrated in our our JS and Python parts of our stack, however there is no official Sentry API for Julia. So I decided to write my own. This is the result.

An example of usage:

# App start - with SENTRY_DSN env var set.
SentryIntegration.init()

# Optional global tags
SentryIntegration.set_tag("customer", customer)
SentryIntegration.set_tag("release", string(VERSION))

# Capturing an exception:
try
    app_loop()
catch exc
    capture_exception(exc)
end

# Manual message:
SentryIntegration.capture_message(
  "Some important error",
  Error,
  attachments=["e.g. JSON"]
)

I also put in some basic support for transactions/spans for Sentry tracing:

SentryIntegration.start_transaction(;
                            name="Name of overall transaction",
                            op="span name, e.g. 'handle web request'",
                            tags=[:url => some_url]) do t
    # Inner function whose logical operation is captured by the name "op"
    # and whose time is to be recorded. This is a "span" in Sentry.
    some_func()
    SentryIntegration.start_transaction(; op="database query") do t
        # This is a nested span in the transaction.
    end
end

I am not doing a full package release/announcement as a) I suspect this package would break in any environment/use-case that is not our exact one and b) I have had no time to document it. I am looking for anyone interested in testing this out and if there is any interest, I would commit more time to bringing the package up to scratch.

1 Like