Skip to content
ImagineWorld

Displaying Data with Dashboards

node_idnode-book_observability-with-grafana_chapter-08-displaying-data-with-dashboards
node_typechapter-node
schema_profileworld.chapter_node.v1
statusactive
entropyhigh
manifoldworld
domainimagineworld.net
authorityinforms
layercorpus
chapter_num8
chapter_titleDisplaying Data with Dashboards
governed_byCORPUS
constitutional_citationCONSTITUTION
local graph

Chapter 8 — Displaying Data with Dashboards

Section titled “Chapter 8 — Displaying Data with Dashboards”

Now that we have explored the topics covered in the earlier chapters together, we have a good understanding of the many ways to retrieve accessible data from Grafana. We will now create our first dashboard together and look at different ways to visualize our data. We will then explore concepts and techniques that help you communicate effectively with your dashboards and reduce cognitive load for your viewers. We will look at a few resources for inspiration out in the community to inspire you with your dashboards. Then, to finish, we will share guidance around managing your dashboard artifacts as they grow to help you get organized.

In this chapter, we’re going to cover the following main topics:

  • Creating your first dashboard
  • Developing your dashboard further
  • Using visualizations in Grafana
  • Developing a dashboard purpose
  • Advanced dashboard techniques
  • Managing and organizing dashboards
  • Case study – an overall system view

In this chapter, you will work with the Grafana user interface using the Grafana Cloud instance and the demo you set up in Chapter 3. Also, to ensure you have all the data sources and settings available, be sure to have implemented the updates in Chapter 6 to your stack. Let’s dive in and create our first dashboard.

Dashboards are a medium to communicate important and sometimes urgent information to consumers. Before we delve into design techniques and best practices, let’s get familiar with the Grafana user interface to start with a simple dashboard. The demo application we have worked with throughout this book has a frontend store; let’s look at the requests we get for its shopping cart.

To create your first panel and dashboard, follow these steps:

  1. In your Grafana instance, select Explore in the menu.
  2. Choose your Prometheus data source; this will be labeled as grafanacloud-<team>-prom (default).
  3. In the Metric dropdown, choose app_frontend_requests_total (the metric count of requests to the frontend app), and in the Label filters dropdown, choose target = /api/cart as the filter (to restrict the results to the cart API only), and then click on Run query. You should see data like this:

Figure 8.1 – App frontend requests

We now have a representation of the time series data in a graph.

  1. To add this to a dashboard, select the Add drop-down menu button at the top of the Explore window.
  2. Choose Add to dashboard:

Figure 8.2 – The Add to dashboard menu

  1. From the pop-up screen, ensure New dashboard is selected, and then click Open dashboard:

Figure 8.3 – Add panel to dashboard

You will now have your new dashboard on screen with its first panel. As you can see, there are a few problems – the legend is difficult to read, the data does not make much sense, and the panel title does not relate to the data:

Figure 8.4 – The New dashboard view

  1. Let’s make a few changes to improve this a little. From the triple-dots drop-down menu, select Edit. The panel editor will appear; you should see something like this:

Figure 8.5 – The panel editor

  1. Give the panel a meaningful name. We’ve entered Frontend Requests in the Title field:

Figure 8.6 – Query options

  1. The graph, by default, will show data from both Range and Instant queries, which can look odd on a time series visualization, as you will see a timeline and then standalone single values. Change Type to Range only.
  2. Click the Apply button to update the panel and return to the dashboard:

Figure 8.7 – The panel Apply button

  1. You will now see the dashboard panel name applied to the metrics shown. Click the Save icon on the dashboard menu bar:

Figure 8.8 – Saving the dashboard

  1. Give your new dashboard a meaningful name that reflects its purpose; we have a Frontend Requests panel, so let’s call it Frontend Dashboard.

Figure 8.9 – The Save dashboard panel

We now have our first dashboard, but it is very simple, with only one panel. It does not effectively communicate much, and the number of frontend requests alone does not give an indication of what is happening to our online store. Let’s explore what else we can do to improve this.

Let’s now develop our dashboard further and improve the information we share. Approaching your dashboard as a work in progress that you can iterate over as you develop the message it is communicating is key to getting the right message across. In this section, we’ll use an example where there’s an increasing count of requests to the frontend app, which does not really tell us much. Showing the rate of those requests makes more sense, as we will be able to see the speed at which they arrive in our app. Let’s make that change now:

  1. From the panel’s triple-dots drop-down menu, select Edit and you will see the following screen:

Figure 8.10 – The panel editor

  1. Back in the panel editor, we can see that the query build gives us a hint to add a rate; this is highlighted with a blue box around it. Click on this hint to add the suggested aggregation to the existing query (if the hint does not appear, click the Operations button, and select Rate with a range of $__rate_interval):

Figure 8.11 – The Rate query

As you can see, the graph now shows how many frontend GET and POST requests per second come into our store. This is much more useful, but the legend is confusing, so let’s clean that up.

  1. Expand the Options section just below the PromQL query preview.
  2. Replace the contents of the Legend field with the Custom label identifier ({{method}}), as shown in Figure 8*.12*; this will extract the values from the method label as the values for the graph’s legend.
  3. While we are here, let’s also change the title to reflect we are now showing a rate, not a count, and add a meaningful description, as shown in the following screenshot:

Figure 8.12 – Panel updates

  1. Once again, click the Apply button to update the panel and return to the dashboard. You should see a dashboard like this:

Figure 8.13 – Our first dashboard

As we can see in the preceding screenshot, we now have a meaningful presentation of the rate of GET and POST requests coming into the frontend API. The name of the dashboard and panel reflect their purpose well, and there is also a new i icon next to the panel, which will display the description you added when you hover over it.

Let’s now look at the visualizations available in Grafana and how to use them.

Grafana has a large selection of visualizations to support your varying use cases and data formats. For example, for the counter and gauge metric types, you could use the Stat or Gauge visualization, and the histogram could use Bar chart or Gauge. Logs can be presented using the table visualization or by generating metrics from your logs in the time series chart. You can find the latest searchable list of plugins here on the Grafana website: https://grafana.com/grafana/plugins/panel-plugins/. A great place to try them out and get ideas you can use in your own dashboards is https://play.grafana.org, where you will find dashboard examples of all the panel visualizations along with a wide range of data types.

To change the panel visualization from within the panel editor, you can use the visualization selector, which is on the top right-hand side. Selecting it will display a searchable list, with a graphical representation of what the visualization looks like. This can be seen in the following screenshot:

Figure 8.14 – Grafana visualizations

Let’s try this with our panel on our first dashboard:

  1. From the panel’s triple-dots drop-down menu, select Edit.
  2. Select Stat from the list of panel visualizations. You should see the dashboard panel change to look similar to the following:

Figure 8.15 – Stat visualisation

To better understand the options available, take some time to try out the different visualizations, or spend time on Grafana Play exploring the examples there. Once you know the visualizations available and the different panel configurations for each, it will become much easier for you to design your own dashboards.

A typical panel configuration will have the following items:

  • A title and description: While the title should help people understand the data presented, the description should complement or embellish the title.
  • A legend configuration: The legend should help interpret data presented with context and clarity. It can be formatted to support visually processing data and can interact with the view, filtering data to the selected item.
  • A standard options setup: This is used to control the options for the units, maximum and minimum values, decimals, display name, and color scheme.
  • A panel-specific options setup: Each visualization can have its own panel configurations.
  • Thresholds: These are used to control colors, backgrounds, or values displayed, based on whether a data threshold value is met or exceeded.
  • Overrides: Custom visualization settings can be applied to data to format and alter the presentation – for example, removing decimals and showing unit identifiers.
  • Value mappings: These are similar to the overrides used to change the visual treatment of your data. They can be used to replace returned values with colors or values based on data matches (including ranges and regular expressions) to alter the visual presentation.

Spending time developing your familiarity with the configuration of some of the main visualization panels will give you the confidence to shape and present data for your users.

Let’s now take a look at some design concepts that will help you present your data more effectively.

When creating a dashboard, it is very important that it has an objective. There are three key questions you can ask yourself to help you get the answers that identify those objectives:

  • Who is the audience?
  • What are their requirements?
  • Where will the dashboard be viewed (on a big screen or a mobile phone)?

A dashboard must tell a story or answer a question, but we cannot do either of those things without answering the preceding questions. Let’s refer to the personas introduced in Chapter 1 to think about the type of people who need dashboards, what they want from them, and where they will see them:

PersonaRequirements
Diego the DeveloperInsight into the traffic flowing through the systems I develop. This will inform how customers are using our product and help me make it better. Often, I need to investigate bugs and dig deeper into errors with much more detail.
Ophelia the OperatorVisibility of problems as they happen, with clear indicators and colors to represent system states. Things need to be simple to understand at a glance. Dashboards will usually be on a large screen but need to be on my computer if I am investigating an issue.
Steven the Service ManagerOverall, a system view that helps me see the wider picture. If there is a problem, I need the information to identify who can solve it. I will view this on my computer.
Pelé the Product ManagerClear and comprehensive metrics that show me how our products are used and with which devices. I will view this on my computer, and often, I want to export it to a spreadsheet for further analysis.
Masha the ManagerAggregated data is useful to me, showing trends with details on recovery rates and capacity so that I can plan ahead. I will view these on my computer, but periodic PDF reports via email help me.

Table 8.1 – Dashboard users and needs

Capturing end user requirements and delivering them with the dashboards you create will ensure value is taken from your observability platform and increase adoption. Once you have your user requirements and have analyzed your data (so that you understand what important information is there), you can start pulling your dashboards together. We say pulling together because it’s important to remember you are creating something to answer a question, and that’s going to take time. Do not be afraid to try out different styles, layouts, and visualizations as you work on the goal for each dashboard. Be sure to test under the different presentation requirements; if it’s a large wall screen display or an emailed PDF, you want to ensure you have verified that it displays correctly.

Let’s look at some techniques that will help with presentation.

To communicate effectively with our dashboards, we can use a layout and some technical features to up our game. Let’s start looking at some of these in detail:

  • Layout tricks: To help get your message across, you need to consider a few layout tricks that really make your message pop. These include the following:
    • Use a short top title in the Overview panel to make it clearer to read.
      • Add a description showing how to use the information and who it’s for to give the users the best chance of understanding the data presented.
      • Call out key indicators using visualizations such as Stat with sparklines, and show them first at the top of your dashboard.
      • Present panels in a grid to visually guide viewers through your dashboard and control their focus.
      • Do not cram too many panels into a single dashboard; this makes it hard to digest. Instead, use datalinks to other dashboards and separate the data more.
      • Use transparent panels to introduce visual spacing on your dashboard and help key data stand out.
      • Use rows to group relevant panels and data together, creating a context for the data.
      • Use the collapse feature of rows to hide certain data when the dashboard loads; this will also have the performance benefit of not running those queries until the row is expanded.
      • Group similar visualizations to make the dashboard easier to read; this makes it easier to process the data presented.
  • Tech tips: Grafana comes with some really useful features; here are a few tips to help you work smarter and speed up your development cycle:
    • Save dashboards often, or back them up by exporting the JSON.
      • Use useful change messages to help your future self when reviewing changes.
      • Remember that dashboard versions are saved, and these can be compared for changes if you need to debug a problem that has crept into your dashboard.
      • Create interactive and dynamic dashboards to engage viewers and deliver a message more effectively.
      • Use dashboard variables to get more use from your dashboard and help the viewer see data they are interested in; these are displayed as inputs at the top of the dashboard.
      • Avoid hardcoding values in panels and queries; your future self will appreciate this as the number of systems being monitored grows and new data is added that changes your dashboards.
      • Use relative time ranges as defaults to ensure the initial view is standardized – for example, set the from time to now-15m to show the last 15 minutes.
      • Use transformations to present your data in more digestible formats. The Transform tab and available transforms are shown in the following screenshot:

Figure 8.16 – The transformation selection screen

  • Use annotations; mark points on a graph with rich events from other data sources or even manual annotations to communicate key events:

Figure 8.17 – Annotations

Let’s now look at how we can develop good practices to maintain control over our dashboards.

As the list of dashboards and teams using them grows, you will need a way to manage them easier. Grafana provides folders, tags, and permissions that give us the capability to get organized. From the main Dashboards screen, you can create folders, move and delete dashboards, and star them, as you can see in the following screenshot:

Figure 8.18 – The Dashboards screen

From the dashboard Settings screen, you can add or remove tags from individual dashboards, as shown in the following screenshot:

Figure 8.19 – Dashboard settings

Let’s look at the available settings for folders, tags, and permissions:

  • Folders:
    • Provide easy organization and grouping
      • Enhanced security by segregating permissions at the folder level
  • Tags:
    • Useful when searching for related dashboards
      • Color-coded for visual recognition
  • Permissions:
    • Control access to folders and their dashboards
      • Give viewer access only to those who do not need to edit
      • Hide folders on a need-to-know basis
      • Available for both individual users and teams

Now that you have an understanding of the concepts involved, let’s look at a case study to develop a dashboard for one of our personas.

We will now walk through the process you would take to develop dashboards for Steven the Service Manager. If you recall from Chapter 1, he works in service delivery. He wants the organization’s services to run as smoothly as possible.

We will start with a use case; in an earlier section in this chapter, Developing a dashboard purpose, we recorded the following requirement from Steven:

“Overall, a system view that helps me see the wider picture. If there is a problem, I need the information to identify who can solve it. I will view this on my computer.”

This can be broken down into the following:

  • A top-level system view
  • Problem indicators (to highlight issues)
  • More detail when needed
  • Assistance in identifying who can help

We then need to gather information from documentation and by having conversations.

We have been using the OpenTelemetry demo app throughout the book; fortunately, architecture diagrams are provided at https://opentelemetry.io/docs/demo/architecture/, which will help us understand the system better.

Let’s look at the OpenTelemetry demo system architecture diagram:

Figure 8.20 – OpenTelemetry demo system architecture

We will also look at what telemetry is being ingested for these applications. This could be done by exploring Grafana ourselves; we have system names now and application flows. Alternatively, we could talk to Diego the Developer and obtain his insight into the system.

If you are exploring by yourself, this is a good time to build a research dashboard. This is where you add panels as you explore and discover interesting data. We did this with our first dashboard earlier in this chapter, starting with frontend requests and then enhancing it to show the rate of frontend requests. Otherwise, start building up a scrapbook dashboard of data you may want to use; do not worry about layout or visualizations right now.

To help us choose useful metrics, we can use a methodology such as the Four Golden Signals, as identified in Google’s Site Reliability Engineering handbook (https://sre.google/sre-book/monitoring-distributed-systems/#xref\_monitoring\_golden-signals). There are other popular methods available – for example, the Utilization, Saturation, Errors (USE) and Rate, Errors, Duration (RED) methods, which we will discuss in the next chapter.

Let’s quickly take a look at the Four Golden Signals:

  • Latency: The time taken to service a request
  • Traffic: How much demand is placed on your system
  • Errors: The rate of requests that fail
  • Saturation: How full your system services are

When you have some key metric data ready for use, you can start shaping your dashboard. Remember that a dashboard should tell a story or answer a question; Steven has said he wants a top-level system view that highlights problems with access to more detailed information as and when needed. We can follow these steps:

  1. Let’s start with the first row of the dashboard, creating the first-look area. By choosing metrics detailing the flow of traffic through our system, we can use visualizations such as Stats (with a timeline) to stand out. Lead the viewer, Steven, from left to right, with the most important information first. Here’s an example of Stats with timeline visualizations for the first-look area:

Figure 8.21 – A system overview

Other visualizations such as Gauge are good to represent the saturation of a system.

To ensure Steven’s attention is drawn to the most important information first, we can enhance our panels with thresholds, overrides, and value mappings. In certain panels, we can even overlay further context as annotations.

  1. We then need to find a way to communicate more detailed information and decide this based on how much information we have to display. We have to ask two questions:
    • Can we present the detailed information here on this dashboard itself (is there enough room)?
      • Do we need to drill down into other, more focused dashboards? For our use case, we will work on the same dashboard. To support Steven with the identification of who he needs to support in the event of an incident, we can do the following:
    • We can logically group our visualizations in rows. Each row can be a team, and the first panel can be a text panel used to share contact information and provide details on how to engage the team. This means the cognitive load when using the dashboard is greatly reduced, helping Steven solve problems more quickly.
      • We can also use panel descriptions to share useful information that helps viewers, including Steven, understand the data, and dashboard links to callout support pages will also help.
      • To represent more detailed information better, we could use visualizations such as the table panel along with color coding to provide visual aids, helping to process the information quicker.

Here, we have an example with top-level insights and more detailed and directional (i.e., identifying the owning or supporting teams) panels and rows:

Figure 8.22 – A detailed dashboard

As you can see from this fictional example, building a useful dashboard requires several iterations. Much more than telemetry alone goes into the process, but the results mean Steven can do his job and have the best shot at delivering customer satisfaction.

Let’s now close this chapter with a few words on how you can support your development with dashboards.

In this chapter, we explored the different components of a dashboard and looked at the different details we need to factor in. These techniques will take time to build, so approach your dashboard development in the same way, get something simple built early, and iterate on it. We talked about the visualizations available for panels and inspiration on websites such as play.grafana.org. Have some fun, and try out alternative methods to present your data and find a style you like. Finally, we looked at some tricks and tips to improve your dashboarding, wrapping up with some simple ideas to help you manage your dashboards.

In the next chapter, we will learn about incident management and the great tools available from Grafana that support it.