Three Steps to Better Error Monitoring with Sentry Releases for Bitbucket
You write code. Release it. Move on to the next project.
As you do, other developers on your team are also writing code. Releasing it. And moving on to their next projects.
It’s only natural for errors to crop up during this process. Insight into what code recently changed and exactly when those changes occurred is extraordinarily helpful when figuring out what’s behind an error. Thanks to our new Releases feature, Sentry’s integration with Bitbucket now provides just that kind of insight, allowing you to link Bitbucket repositories with Sentry and making the error-handling process easier and far less frustrating than it’s ever been before. Enjoyable even.
“It’s never enjoyable to find errors,” says Morgan Bruce, VP of Engineering at Onfido and a Bitbucket + Sentry user, laughing. “The process of diagnosis when using Bitbucket and Sentry is a lot more rapid. The chance you’re going to look at the commits and see immediately where this error came from is much higher. So resolving errors actually becomes enjoyable.”
Releases tie each error to a specific Bitbucket commit and put this information directly in the hands of the engineer who is best suited to deal with it.
“Previously, digging out exactly which commits were in a release was a bit of a rigamarole,” says Morgan. “Releases improved our workflow, getting that tight connection between when the bug was introduced into our system, the potential cause, and, with commit data directly from Bitbucket, whose code changes might be behind it. We previously had to combine a few different tools to get this same work done — it was inefficient.”
How can you access these same benefits in your Bitbucket commit and deploy workflows?
To make Sentry aware of commit metadata and unlock the Releases feature set, you need to connect your Bitbucket repository.
This is done through the Sentry UI. Just go to your organization’s dashboard, click “Repositories” and then click “Add Repository.” Sentry will create a webhook and start collecting commit metadata, which you can then connect to version releases for cross referencing.
Ideally, error visibility is not limited to engineering, as it benefits everyone who touches the product in any way.
Too often, error resolution involves Support pointing an accusatory finger at the Product team because a number of customers started experiencing flu-like symptoms and bouts of full-body levitation not long after a particularly active round of Bitbucket Pipeline activity. Customers are yelling at Support, their leads are scavenging JIRA tickets trying to source the problem, and the CEO is poking around HipChat and posting on Stride to find out when the problem is getting fixed. Before you know it, PR has a Trello board of lists for dealing with the fallout.
With this the Sentry + Bitbucket integration, however, errors are tied directly to both users and commits, allowing Support to immediately see what a customer is talking about when they reach out about a problem. For Onfido, Sentry’s updated integration means automatically getting any issue in front of the right developer as part of a natural workflow that lives primarily within Bitbucket. “That’s really helped the entire organization a lot,” says Morgan.
Once Sentry is consuming the commit data of your Bitbucket repository, the next step is to configure your deploy process to make an HTTP request to Sentry’s release and deploy endpoints as code moves through your deploy process. If you manage deployment with Bitbucket Pipelines, this means adding a step to your
Additionally, you can use the short id associated with a Sentry issue to include
fixes <SHORT-ID> in your commit messages. When we see this referenced in a commit, we’ll note it in Sentry and mark the issue as resolved when the commit becomes part of a release.
“And the new deploy emails have been an unexpected benefit,” says Morgan at Onfido. “When I was integrating this feature, that really wasn’t what I was thinking about. But it’s been really nice to have a clean email go out detailing exactly what’s just been released. It’s something the engineers have really liked.”
These emails go out to all parties involved in a deploy, detailing how many files have changed and what commits have been released. This extra context allow you to track what commits go to what environment at what time, giving you the complete picture of a changeset’s lifecycle.
The Sentry + Bitbucket integration has made pinpointing issues more efficient and effective for organizations as large and diverse as Deloitte. “Our threat intelligence teams often work with several sources of information, including collecting and structuring public and open-source artifacts that our analysts can explore, search, and operationalize,” says Artur Monteiro, Director at Deloitte Central Europe. “We decided to explore Sentry’s Bitbucket integration to provide application-level alerts that speed identification of new patterns. With the additional context from Sentry, our engineering team is able to rapidly adjust prototype data models and ensure that the code in Bitbucket always accounts for the new structures our analysts encounter.”
At its best, error tracking isn’t just about putting out fires. It’s about building fire-retardancy through observability and iteration. Resolving errors and making fast, meaningful changes is easiest when developers and other teams can tie the details of an error to the details of the entire commit-deploy workflow that preceded it. For Onfido, Deloitte, and many others, Sentry’s updated Bitbucket integration provides a necessary level of visibility into releases for everyone on the team.