When we were a few months into developing Insider’s in-house testing tool for the products in progress, we hit a wall. Although the project progressed quite fluidly, we came across a point we didn’t give any thought to..
As the project got bigger and more complicated, we were having a hard time fixing bugs in our efforts to stabilize our code. At one of our meetings, we discussed what was preventing us from fixing bugs and progressing. The problem became clear to everyone; our error tracking methods which worked right when we started our the project became quite confusing and risky at a larger scale. As the Quality Assurance Team, we needed a solution to implement to the tool and it had to be done with minimal code base so that we didn’t have to edit the basis of the project. We decided on giving Sentry.io a try. Sentry.io is a real-time error tracking tool which gives developers insight into production deployments and information to reproduce and fix crashes.
Our project was written in Python which left us with two options to integrate a new tool. Either, we had to create a function and call it every time an error occured or we had to create a structure to check existing functions before we could alter their code. For this case, creating a decorator function was the perfect solution. If you are not familiar with Python, decorators can be described as a function/code which surround your function like a wrapper.
We decided to create a basic decorator function which would wrap the original code and run active at the same time. Basically it looked something like this:
*Please note that this code is simplified with respect to the privacy of the project.
As a result, integration was taken care of and we’ve been using Sentry.io for around 2 months now. I believe that it makes error tracking process so effortless that you will not bother implementing any other solution.
Key factors which made Sentry.io so attractive were the following 3 qualities it had to offer:
Sentry was able to capture stacktrace and relevant code snippets
Tag context: We were able to filter logged errors with nearly anything we had on the project such as Class / Function Names etc.
Releases: At a later stage we decided to use Jenkins as well, and hence we integrated Jenkins API to Sentry.io. Each time we ran a test suite inside Jenkins, Sentry.io was able to create a new release tag for issues which were relevant for that run
Tell us about your solution to track errors on a given project in the comments below!