Grafana, Prometheus and a bunch of SQL’s

Alberto Cubeddu
3 min readAug 7, 2018


Everybody loves statistics, and we are not excluded, working with a business model that require achievable goals, based most of the time on numeric targets, we will like to have an easy way to see the overall situation without running the queries by yourself.

Having this in mind, we decide to investigate in a solution that includes: extraction, collection and visualisation of statistics that can be used even by a non-tech person.


We need to find a job system able to query the database at a specific interval, and prometheus-SQL is the tool that will do the job!

We can configure a sql-job with just a few lines of code and repeat it using a defined time interval, automatically it will insert all the data into a time-series database, seamless!


As we are collecting data at a specific time-interval this allows us to play around with time-series database:

Prometheus, an open-source monitoring system with a dimensional data model, flexible query language, efficient time series database and modern alerting approach.

At this stage, we have all our data extracted from our relational database into time-series events in Prometheus:

As you can get from the description, Prometheus is not only a time-series database but it not full-fill our requirements “can be used even by a non-tech person”.


Grafana offers data visualization & Monitoring with support for Graphite, InfluxDB, Prometheus, Elasticsearch and many more databases.

And as the description mention, Prometheus is one of the product that this software integrates with just a few clicks, and this is the result:


Using a combination of 3 different tools: Prometheus-SQL, Prometheus and grafana we can extract, collect and visualise different metrics based on our projects, and with the simplicity of this stack we are even able to add other queries in few necessary steps.

The MVP workflow looks like:

Jim Barksdale, the former CEO of Netscape, said it best:

“If we have data, let’s look at data. If all we have are our opinions, let’s go with mine.”



Alberto Cubeddu

Leadership || Management || Innovation - Technology Director & Former Head Of Engineering