Building dashboards

In Sonar, it is advisable to build dashboards to track certain metrics. These dashboards are based off Measure reports. These reports filter and arrange the data and make it available in your dashboard as a list, a chart, or any of the supported visualisation widgets available.

Preparing our dashboard

To get started, pick a topic which warrants your attention. In this example, we will focus on a dashboard which tells us what's currently building on the master code branches.

Creating a first Measures report

Start by clicking on the Measures tab on top and create a new Measures report.

Now click on Change Columns. When you insert a column, you have the option to pick its value, or a differential value as compared to a predefined point in time.
For this report, we will be picking the columns:

  • Quality Gate status
  •  Last Analysis
  • Unit tests duration
  • Unit Tests Success
  • Overall Coverage (since previous analysis)
  • Name

We will also add a few filters to focus our attention on the projects from the master branches, built in the last 10 days. The final report should look something like this.

Monitoring new technical debt

Our dashboard will also need to warn us when new technical debt issues are found. We can achieve this by creating a Measures report like this one. Make sure to set the columns to their differential value from last build as explained above.

More advanced metrics

There are more advanced metrics available to help you build the most useful dashboard for your team. Let's keep track of how well tested our new code is since the last release.

From the Measures module, create a new report using these columns.

  • Quality Gate
  • Overall Coverage on New Code (since last version)
  • Overall lines to cover on New Code (since last version)
  • Unit Tests Success
  • Project Name

The final assembled report should look something like this.

Putting it all together.

Now let's create a new dashboard using what we have just created.

Go to Dashboards->Manage Dashboards and click Create in the top right corner. Give your dashboard a name and a description. Don't forget to check Shared if you want to make this dashboard available to other users.

From the dashboard, click on Manage Widgets to customize it and add your content.

To insert your Measures reports as-is, simply select the Measure Filter as List option.

Graphics

Some metrics are better visualized as graphs. Take for instance the amount of time required to run the tests. Where exactly is the time spent? Which projects would it make more sense to optimize, and which are not worth it as a whole?

Graphics are created by using the appropriate dashboard widget. These widgets are also backed by a Measures report, so make sure to create the proper list of metrics you need for your particular graphic.

 

The final result

Once assembled, your dashboard is ready to be shared. To access other people's shared dashboards, simply go to the Dashboards -> Share Dashboards menu and subscribe to those you're interested in. They should now appear in your Dashboards drop-down menu.

You can check a finished example here.