Over a million developers have joined DZone.

Intro to Raygun: Your Personal Exception Blaster

DZone's Guide to

Intro to Raygun: Your Personal Exception Blaster

· DevOps Zone ·
Free Resource

Read why times series is the fastest growing database category.

When you are building your apps or games, you always put lots of hours of effort into testing, bashing and trying to break/fix it until you are happy with the end result, errors are trapped and you have been as careful as you can be to make it the best product ever.

Then you deploy it and the world goes boom!

Exceptions are a way of life when you are building any solution, you do your very best to prevent them or handle them well should they occur, but real life (and real users) always throws a spanner in the works.

I’ve played, tested and even built many frameworks to handle what happens when the unthinkable happens and tried several ways of reporting what happens so it gets back to you, whether that’s by email, text, web call or just a user throwing their device at you because they are unhappy (yes, that happened once).

So what can we do without spending even more hours trying to figure out what is going on, just how healthy our apps or games are in the real world, and just what the user is getting for their money?

Enter Raygun

Raygun is a new framework and complete reporting suite aimed at helping out in the world of error reporting. They offer a whole suite of reporting stats and a very appealing and well-rounded dashboard to give you full control of your reported errors.

Integration is also very easy and, in most cases, just a single line of configuration added to your app.

What makes it even better is that you are not limited to just one platform as they have most of the bases covered in that arena. More on that later.

Who’s backing this?

Raygun certainly isn’t a backroom company or a two man band as it’s provided by the fantastic crowd over at Mindscape.

Mindscape, who have already set themselves ahead with award-winning controls, tools and frameworks have extended into the area of exception management, so you can be assured of top class support.

I’ve been using their Phone Elements controls in my phone project since it launched and it has always impressed.

Platform Support

Raygun has an impressive line-up of supported platforms, including those below:

What makes this platform selection even better is that the clients for most of these frameworks are hosted on GitHub (under the permissive MIT license) so you have full access to the source and you can use it “as is” or make tweaks of your own.

Just to really top things off, the Raygun client is also available on NuGet--not many other providers can boast that.

As you would expect from any professional provider, all these clients and their integration instructions are fully documented here: http://Raygun.io/Raygun-providers, all clearly laid out and easy to understand.

The integration doesn’t stop there, as well as all of the platforms you can integrate the exception watching code into, there are also a growing number of plug-ins to Raygun itself, enabling Raygun to create new bug reports based on errors found, or have it post new errors to some of the popular chat room boards so that collaborating devs will immediately be notified when things go awry.

Plug-ins include:

If you also are in to Trello by Fog Creek then there is even a plug-in for you, adding Kanban style cards to your board for working on.

All right, I’m hooked – what’s it going to cost me?

Well software assurance doesn’t come free, however there is a free trial for 30 days to test the water, just to make sure you are happy with the service.

This is their current breakdown and service offerings, prices are per month:

To an indie these prices may seem a bit steep but if you are serious about the apps or games you ship and have a large user base, or if you work for a company with the budget, then this level of reporting and analytics is crucial to your business model.

In all cases it doesn’t matter how many people use your app, the only metric that is really important is how many errors you’re trapping and have to manage each month.  That also goes for how many members of your team are watching the reports or receiving alerts.

Under the Hood

Adding the client code to your project is really simple as stated earlier, simply:

  • Download the client library through NuGet or the source from GitHub
  • Register your Raygun App ID in the app (either in config or on app start-up)
  • Add the reporting line of code in your exception handling code (full details provided for each language)

The only exception to the above path is with Windows 8 / RT, since the entire platform is async based the unhandled exception routines only handle XAML or UI errors, background events and web calls are not caught, however Raygun provides a “WRAP()” function to use to call your async functions which nicely wraps up your call with a handy try/catch including the reporting code.  Another option is to use the Fody library, and its AsyncErrorHandling extension.

The flexibility doesn’t stop there as you can extend the data reported back to the server with your own custom data, for example:

Allowing you to append your custom data with the report as it’s sent back.  Be careful how big the data you are sending back is, of course--too much and either it will time out or the app will have finished closing before completing the send.

At the time of writing, completely custom reporting is not supported.  All reporting data in the backend is linked to fully formed error exceptions, so you cannot just report back custom data.  However, they see this gap and are working on a solution. 

Getting on the Dashboard

Now the simplicity in the error reporting integration is fine but what about the end result, what about the data?

As it turns out, Raygun’s might is in its visual representation of your reported errors and then what it can do with it as well (like the aforementioned plug-ins)

At first look on entering the dashboard you’ll see a nice slick interface:

Here we see the running totals of issues that the Raygun site has been fed from your app. On closer inspection of the issue we have logged we can see Raygun is intelligent enough to group similar exceptions together, so instead of looking at just a raw error log, you see analysis from the get go:

So from 1 issue we can see we actually have 204 reported occurrences of that one issue.

Drilling in to that one issue gives us the recorded history timeline of that issue:

Now we can see not only how many times this error has occurred but the frequency it is happening over a period, so we can determine not only when it occurred but its relation to the past events.

As we continue through the dashboard we also have an opportunity to keep logged information about the error, this becomes especially useful when working in a team as you can share notes and actions taken to combat this pesky bug:

Drilling down further we can get even more information out of each exception and you can page through each exception so you can see (like a flip book) any differences between the occurrences:

The additional tabs give you even more information (depending on the platform it was reported from) on the data behind the exception like how much memory was available and was being consumed, what the request data was like (http style only) and much much more.

If you are so inclined, Raygun really does not hide anything and you can even see the raw json request data that was sent to Raygun from your app.

Final Thoughts

Working with Raygun has already been fruitful for myself, solving some low memory issues with some of my mobile apps (things I couldn’t replicate locally) and shown them being fixed over time.

No matter the size of your team you are going to find Raygun invaluable to solve those mystical unknown errors that only a user or random device can locate for you, if you care about customer experience then this process is key to achieving the highest satisfaction rates.

Learn how to get 20x more performance than Elastic by moving to a Time Series database.


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}