destroytoday.com

Updating Sentry

Continuing my dependency-updating frenzy, last night I took aim at Sentry, Cushion’s error-tracking service. I love Sentry because it’s obviously built for developers by developers, but like with other services, I set it up when I started Cushion and haven’t kept up with any of the new features they added over the years.

Updating the Ruby gem was easy and uneventful because it doesn’t seem to have changed much in years. The Node package, however, was a significant change. For one, it now uses the “Sentry” name for the import name rather than “Raven”. Also, a good chunk of the functionality has been extracted into a separate @sentry/integrations package. This meant I needed to manually initialize the integrations for both AngularJS and Vue.js. This was pretty straightforward, so it was no problem at all.

After updating the dependencies, I focused my attention on a few “new” features that I definitely wanted to set up. The first feature was environments, which provides the same value as the environments I set up for Skylight. Because I used Sentry before this feature existed, I’d been hacking it by creating separate “projects” for each environment. Now, I can simply specify the environment when initializing Sentry, and Sentry will then separate errors into their appropriate environment.

While the default behavior uses the RACK_ENV variable, I wanted to be more specific with my environments to support Cushion’s review apps and staging app separately. To accomplish this, I created a new SENTRY_ENV variable. Originally, I considered a general environment variable to configure both Sentry and Skylight’s environments, but unfortunately, Sentry’s Ruby gem doesn’t support dynamically-named environments, so I would’ve had to manually add each review app’s ID to the array of environments—not gonna happen. Once I finished setting up environments, I was able to clean up my Sentry account and delete the older environment-specific projects.

Next up, I wanted to take advantage of Sentry’s releases feature. By configuring Sentry to use the release version of Cushion’s Heroku apps, I can start grouping errors by release. If an error starts occurring, I know which release it started in. I can also track its fix more easily. This is especially handy for front-end errors where the user might be using a previous release version of the front-end because they had Cushion’s browser tab open for days, weeks, or even months—this is a real thing. For significant updates, I have a way of alerting the user of an update and sneakily refreshing the browser when they click to see what’s new, but aside from that, people tend to keep their tabs running forever.

Finally, I upgraded Sentry’s Slack integration. This last one was more from Sentry prodding me to migrate off their legacy integration, but I’m glad I did! While the previous integration simply alerted me of errors, the new integration provides buttons for resolving, ignoring, and assigning. I have absolutely no use for the “Select assignee…” button, but resolving and ignoring will come in handy.