Time series dimensions
With time series data, the data often contain more than a single series, and is a set of multiple time series. Many Grafana data sources support this type of data.
The common case is issuing a single query for a measurement with one or more additional properties as dimensions. For example, querying a temperature measurement along with a location property. In this case, multiple series are returned back from that single query and each series has unique location as a dimension.
To identify unique series within a set of time series, Grafana stores dimensions in labels.
Each time series in Grafana optionally has labels. Labels are set a of key/value pairs for identifying dimensions. Example labels could be or {country=us,state=ma,city=boston}
. Within a set of time series, the combination of its name and labels identifies each series. For example, temperature {country=us,state=ma,city=boston}
could identify the series of temperature values for the city of Boston in the US.
Time series databases (TSDBs) usually natively support dimensionality. Prometheus also stores dimensions in labels. In TSDBs such as Graphite or OpenTSDB the term tags is used instead.
In table databases such SQL, these dimensions are generally the GROUP BY
parameters of a query.
Multiple dimensions in table format
In SQL or SQL-like databases that return table responses, additional dimensions are usually represented as columns in the query response table.
For example, consider a query like:
This query would return a table with three columns with data types time, number, and string respectively:
The table format is a long formatted time series, also called tall. It has repeated time stamps, and repeated values in Location. In this case, we have two time series in the set that would be identified as Temp {Location=LGA}
and .
If the query is updated to select and group by more than just one string column, for example, GROUP BY BUCKET(StartTime, 1h), Location, Sensor
, then an additional dimension is added:
StartTime | Temp | Location | Sensor |
---|---|---|---|
09:00 | 24 | LGA | A |
09:00 | 24.1 | LGA | B |
09:00 | 20 | BOS | A |
09:00 | 20.2 | BOS | B |
10:00 | 26 | LGA | A |
10:00 | 26.1 | LGA | B |
10:00 | 22 | BOS | A |
10:00 | 22.2 | BOS | B |
In this case the labels that represent the dimensions will have two keys based on the two string typed columns and Sensor
. This data results four series: Temp {Location=LGA,Sensor=A}
, Temp {Location=LGA,Sensor=B}
, Temp {Location=BOS,Sensor=A}
, and .
Note: More than one dimension is currently only supported in the Logs queries within the Azure Monitor service as of version 7.1.
Note: Multiple dimensions are not supported in a way that maps to multiple alerts in Grafana, but rather they are treated as multiple conditions to a single alert. See the documentation on .
In the case of SQL-like data sources, more than one numeric column can be selected, with or without additional string columns to be used as dimensions. For example, AVG(Temperature) AS AvgTemp, MAX(Temperature) AS MaxTemp
. This, if combined with multiple dimensions, can result in a lot of series. Selecting multiple values is currently only designed to be used with visualization.
Additional technical information on tabular time series formats and how dimensions are extracted can be found in .