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.

2 Likes

HI Pengwyn,

I’m interested in helping out here.

1 Like

Great! Are you using sentry in one of your projects? I think testing it out, and seeing if it fits in nicely or if it breaks, is the first thing I’d love to hear about.

Exactly, I’m using sentry in some prototypes and transitioned into using Julia

1 Like

Hi @pengwyn, I’m really glad to see that there is a Julia package for sentry. Definitely going to take a look at the repo. Any particular status updates?

Hey, Pengwyn. I was very excited to find your GitHub repo today. I am looking to add Sentry for a monitoring layer atop a production API service written in Julia. I am relatively new to the language, so you can let me know if there is an easy fix to my issue feedback below here;)

I want to install and test out your implementation, but it seems to be version locked to 0.4.8. Is there a trivial way to make the package work for Julia 1.8.x?

Happy to help test the integration, if you’re still working on / supporting it.

Cheers,
Alex

Sorry @aartinian I didn’t see your message till now. Unfortunately I’ve had to stop using Julia for work to my dismay, so I haven’t been able to actively continue on the package.

There have been a couple of PRs for the package though, and it works for at least some people so I’m happy to keep supporting it. If someone would like to take it over too that would be good as well.

Great to hear you’re interested in using it @alextruesdale! I’m eager to help, but I’m not sure what the problem is exactly. You mention version 0.4.8, which is the version of the package itself, and that version should support Julia 1.8. I did muck around with it recently in 1.8 to double check the recent PRs.

The package isn’t in the official Julia registry, so you have to add it using the git URL directly, or cloning the repo locally and adding it that way. I could make a request for it to be added to the official registry, but I’d have to sort out some of the coding style to bring it into better alignment with the Julia standards.

If it’s not working in Julia 1.8, can you give me a more specific error message? Or submit an Issue on the github page?

Thank you for the reply @pengwyn! You are right. I misunderstood the error message in the Julia REPL and conflated the package version with a Julia version restriction. I will create an Issue over on GitHub, as it is the more appropriate place for bug fixing.

EDIT: after overcoming the small installation bug (for those interested, see GitHub), everything works excellently – thank you very much for putting this integration together, @pengwyn.