Why Grafana?
While there are many solutions in the data visualization space, Grafana is proving to be one of the most exciting, exhibiting rapid growth in scope and features, broad options for deployment and support, and an enthusiastic community contributing to its future growth. Before going into the specific features that make Grafana an attractive solution, let’s take a look at the criteria we might use to characterize a useful data visualization application:
Figure 1.1 – Grafana UI
For the purposes of this book, we will be looking at particular software applications that fulfill four major functions: exploration, analysis, presentation, and observability.
Exploration
Quickly loading and displaying a dataset with the idea of identifying the particularly interesting features for deeper analysis, sometimes referred to as drilling down, is an example of data exploration.
Another common term for data exploration is ad hoc analysis. This refers to the nature of using data visualization techniques without a pre-defined analysis in place. Ad hoc analysis is useful for getting a feel for the data’s characteristics, and whether any interesting patterns are discernable.
Figure 1.2 – Grafana exploration
In this book, we’ll be frequently using the Explore feature of Grafana to perform just this sort of data exploration.
Analysis
After we have examined our data, we may well want to analyze it. That is, we may want to quantify the data statistically or correlate it with other data. For example, we may want to see what the maximum value or average value is, or otherwise aggregate the data for a specific time range. We may also want to look at multiple datasets over the same time period to look for events that might be time-correlated.
Figure 1.3 – Grafana analysis
Grafana contains several analysis features that we highlight throughout the book. We will also leverage Grafana’s powerful transformation features to aid us in our analysis.
Presentation
Once we have identified the data we are interested in, we will want to present it in an aesthetically pleasing manner that also gives the viewer clarity about what the data represents, in effect helping to tell a story about the data, which would be otherwise difficult to do without specific domain knowledge.
Figure 1.4 – Grafana presentation
Assembling panels into dashboards is a common Grafana workflow for presentation, and we will spend much of our time in this book covering not only how to construct dashboards to tell the story of our data, but also how to structure our data visualizations to be both clear and meaningful.
Observability
Finally, we may need to observe the data over time, or even in real time as it may represent critical data. If the data crosses into a realm of concern, we may need to be notified immediately.
Grafana has extensive and powerful observability features, along with integrations for popular notification services such as PagerDuty. In this book, we’ll learn how to build alerts to detect anomalies in our data, and how to craft appropriate notifications depending upon the severity of the alert.
Choosing Grafana
While there are quite a few powerful data analytics tools on the market that fulfill these functions, Grafana has a number of features that make it an attractive choice:
- Fast: The Grafana backend is written in Google’s exciting Go language, making it extremely performant when querying data sources or feeding thousands of data points to multiple dashboard panels.
- Open: Grafana supports a plugin model for its dashboard panels and data sources. The number of plugins is constantly growing as the Grafana community enthusiastically contributes to the project.
- Beautiful: Grafana leverages the attractive and powerful
D3
library. Many of the popular dashboard tools, such as Datadog and Zabbix, can quickly generate beautiful graphs from thousands of data channels, but they only offer some limited control over the display elements. Grafana provides fine-grained control over most graph elements including axes, lines, points, fills, annotations, and legends. It even offers the much sought-after dark mode. - Versatile: Grafana is not tied to a particular database technology. For example, Kibana is a powerful, well-known member of Elasticsearch’s Elasticsearch, Logstash, and Kibana (ELK) stack; it is only capable of visualizing Elasticsearch data sources. This gives it the advantage over Grafana of a better ability to integrate Elasticsearch’s analysis tools in its graphing panels. However, due to its plugin architecture, Grafana can support a variety of ever-growing data sources (at last count in 2022, over 150), from traditional RDBMs, such as MySQL and PostgresQL, to modern TSDBs, such as InfluxDB and Prometheus. Not only can each graph display data from a variety of data sources, but a single graph can also combine data from multiple data sources.
- Free: While they are very powerful tools indeed, Datadog and Splunk are commercial packages and, as such, charge fees to manage all but the smallest datasets. If you want to get your feet wet, Grafana is freely available under the Apache open source license, and if you do plan to run it in your enterprise, you can purchase tiered support.
These are just some of the criteria you might use to evaluate Grafana against similar products. Your mileage may vary, but now is a great time to be in the market for visualization tools. Grafana and its competitors each have their own strengths and weaknesses, but they are all very capable applications. Here’s a short list of the few we covered:
- Kibana (https://www.elastic.co/)
- Splunk (www.splunk.com)
- Datadog (https://www.datadoghq.com/)
- Zabbix (https://www.zabbix.com/)
With this in mind, let’s install Grafana.