Label your exceptions and stay organized with Raygun’s tagging feature

| 3 min. (560 words)

Tags have been a part of Raygun Crash Reporting for a some time now and are an important part of helping developers track and filter their exceptions.  Tags may seem simple at first glance but the power they give developers to stay organized and save time in tracking down the source of an exception makes them an integral part of maintaining applications.

It only takes a few minutes to get tags set up in your code but they can save you hours of developer time down the road when your application grows larger and the exception causes become more complex.

So what are tags?

Tags are labels that can be given to exceptions inside your code.  These labels are then passed onto Raygun when exceptions are tracked. Having tags on your exceptions gives you several powerful abilities when it comes to better organizing your inbound exceptions. Raygun allows you to filter your exceptions in three ways:

  1. Inbound filters: You can filter out inbound exceptions by tag.
  2. Searching: You can search for specific tags to see associated exceptions.
  3. Filtering: You can filter for or against specific tags.

These three abilities are great in themselves, but where they really shine is when used in unique ways. For example:

**Do you have a custom checkout path through your application for certain VIP users?  **

You can use the tag feature to quickly differentiate the exceptions thrown along these custom paths from normal user paths even if the stack traces are nearly identical.

**Do you have pages that contain several different resources or scripts being loaded from different sources?  **

You can use tags to logically separate out those pages into distinct sections to narrow down the source of an exception when one is thrown.  So when an exception gets thrown due to a small section of a loaded page you can quickly drill down on know which section without having to sift through error details.

Here at Raygun, we use tags when building Visual Studio extensions to capture a snapshot of the currently running/installed extensions when an exception is thrown.  At a deeper level, when an exception occurs we do a quick query of currently active extensions and add them as tags to the exception before sending it to Raygun.  This allows us to track which extensions might be causing a conflict and to quickly search/filter through those exceptions.  Additionally it enables us to see if there are any patterns between the exceptions and extensions that were active at the time.

Do you use different environments for testing, dev and/or production?

You can use tags to differentiate between environments. This is especially important for incident triage – if you see a critical error instance with a ‘production’ tag, you can then prioritize your workload to fix the production bug. If, on the other hand, the error instance was tagged as being in a test environment, you would may choose to give that error instance less priority on your backlog.

Now that we know why tags are important, let’s take a look at how to effectively tag exceptions in detail:

We offer the tag feature on the following supported languages:

We are continuously working adding tag support to other languages but if you have a specific language request please let us know!