Rearview on Rails

For those who may not know, rearview is a real-time monitoring framework that sits on top of Graphite’s time series data. This allows users to create monitors that both visualize and alert on data as it streams from Graphite. The monitors themselves are simple Ruby scripts which run in a sandbox to provide additional security. Monitors are also configured with a crontab compatible time specification used by the scheduler, and alerts can be sent via email, pagerduty, or campfire. Originally implemented in Scala, rearview was recently rewritten in Ruby. This will make support and development easier going forward as Ruby is the primary language used at LivingSocial.


From a back-end technology perspective much has changed as you can image. Trent Albright discusses these changes in his excellent post on open sourcing with rails engines. Some highlighted benefits of this approach include: the ability to separate configuration from code, excluding gems that may not be appropriate for all users, and the ability to create well defined extension points for your application. He goes on to discuss various Rails Engine use cases as well as walking you through a refactoring exercise. I highly recommend taking the time to read it.

The front-end technology, on the other hand, did not go through a similar change. In fact, Ian Quattlebaum’s fantastic post on rearview’s frontview tells us that less than 1% of the front-end code changed when we ported from Scala to Ruby. As Ian writes, this was because “none of our front-end application was tied to the service implementation, including templates with Handlebars, simply making sure the API didn’t change was all that was needed.” Again, I highly recommend you read the full post as Ian walks you through the thought process of choosing the appropriate technologies for a given project.

Dashboard Categories

The Ruby port of rearview is much more than a back-end technology change or a even a long list of bug fixes. In fact, two main categories of features were added to the application, with the first being dashboard categories. As you can see from Figure 1, adding a new dashboard to the ecosystem works the same as it always has. What’s different is you now have the ability to navigate directly to a dashboard category using the drop-down menu. In this example, we will be loading the “authentication” category of the “accounts” dashboard. This is helpful as it allows users to avoid overly large dashboard by separating monitors into similar groupings.

Figure 1: Navigation to Category Using Drop-Down Menu

In addition to using the drop-down menu to load a dashboard, clicking a dashboard tile in the ecosystem view will load the dashboard, or the parent category if multiple categories exist. To create a new dashboard, simply click the “add a new dashboard” link located in the bottom right corner of the browser window. To create dashboard categories, however, you’ll need to access the dashboard settings menu as shown in Figure 2. You do this by first hovering your mouse over the dashboard tile until the gear icon appears. Clicking the gear icon will flip the tile so that you have access to: 1) changing the dashboard’s main title, and 2) adding categories. To change the title simply edit the title in the text box and click the blue check mark (or click the “x” to exist.) Likewise, click the “+” to access the add category functionality.

Figure 2: Rearview Dashboard Settings

Once you’ve clicked the “+” in the dashboard’s settings, you will presented with the “add a new category” modal as shown in Figure 3. This screen will allow you to add a single new category and optional description by entering your text and clicking “save & close”. If there are several categories you wish to add, you can repeat the process by clicking “save” between entries. Finally, any existing categories for the dashboard will be listed at the bottom of the modal to help eliminate duplicate entries. It should be noted that creating the first category for a dashboard that already contains monitors will simply move those monitors into that first category. Later in this post we’ll discuss how you can move monitors out of this category.

Figure 3: Adding Dashboard Categories

Once you have a dashboard with more than one category, you can navigate directly to a specific category via the drop-down menu as we mentioned earlier. Likewise, clicking the dashboard tile will load the dashboard’s first category. Once a dashboard category has been loaded, however, there are multiple ways to navigate between them as shown in Figure 4. In rearview, dashboard categories are presented in a carousel formation meaning you can click either the right or left arrows to cycle through the categories one at a time. Additionally, you can click the dots located above the monitors to load a category directly. As you load a new category, its description, if one was entered, will briefly appear at the bottom of the screen to help you remember the purpose for the monitors located within it.

Figure 4: Navigating Dashboard Categories

Monitor Ordering

As mentioned earlier, monitories can be moved between categories for a given dashboard. As you’ll see in Figure 5, this feature is located in the new settings tab for a monitor. To access this tab you will need to navigate to the dashboard category, click on the monitor’s title to load the “edit monitor” view, and finally click on the “settings” tab. Once there, a drop-down menu will show you the current category for the given monitor. To move it to a different category simply select the new category and click save. It’s important to note that this will only move the monitor to a category within the same parent dashboard. At this time monitors can not be moved between dashboards themselves. Finally, you’ll notice in Figure 5 that rearview now supports three different alerting mechanisms. Clicking the blue info icon shows you how to enter alert URIs for email, PagerDuty, and campfire alerting.

Figure 5: Moving Between Categories

There is one other way that users can order their monitors in a way that is more useful to them. The latest version of rearview now supports the ability to drag and drop monitors within a category or dashboard. As show in Figure 6, simply click and hold the drag-n-drop icon to the left of the monitor’s gear icon and move the monitor to the desired location. Once you let go, the monitor will drop into place and all other monitors will shift to the right or left depending on the drop location. It’s also important to note that this new order will appear only for the user who moved the monitor. All other users will see their own preferred ordering with alphabetically being the default.

Figure 6: Drag And Drop Monitors


I am personally excited about this new version of rearview. From a features and functionality perspective it has proven invaluable in monitoring application and business process performance by providing an extremely flexible way to manipulate and analyze real-time times series data from Graphite. I am also impressed with both the front and back end architectures, both of which provide a responsive application that should prove an easy to implement OSS within your organization. Finally, I’m exciting to see that contributions to this project are starting to come in and I look forward to all future collaborations.

This post is cross-posted from Steve Akers’ blog.