首页 > 其他分享 >Grafana学习(4)——Time series dimensions

Grafana学习(4)——Time series dimensions

时间:2023-11-22 12:46:41浏览次数:34  
标签:dimensions series Time 序列 Location time 维度

In Introduction to time series, the concept of labels, also called tags, is introduced:
       Another feature of a TSDB is the ability to filter measurements using tags. Each data point is labeled with a tag that adds context information, such as where the measurement was taken.

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.

Introduction to time series中,引入了labels的概念,也称为tags:
TSDB的另一个功能是能够使用标签过滤测量结果。每个数据点都标记有一个标签,该标签添加了上下文信息,例如测量的位置。
对于时间序列数据,数据通常包含多个序列,并且是多个时间序列的集合。许多Grafana数据源都支持这种类型的数据。
常见的情况是为具有一个或多个附加属性作为维度的度量值发出单个查询。例如,查询温度测量值和位置特性。在这种情况下,从单个查询返回多个序列,并且每个序列都有唯一的位置作为维度。
为了识别一组时间序列中的唯一序列,Grafana将维度存储在标签中。

Labels
Each time series in Grafana optionally has labels. Labels are a set of key/value pairs for identifying dimensions. Example labels could be {location=us} 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.
Different sources of time series data have dimensions stored natively, or common storage patterns that allow the data to be extracted into dimensions.
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.

标签
Grafana中的每个时间序列都有标签。标签是一组用于标识维度的键/值对。示例标签可以是{location=us}或{country=us,state=ma,city=boston}。在一组时间序列中,其名称和标签的组合标识每个序列。例如,温度{country=us,state=ma,city=boston}可以确定美国波士顿市的一系列温度值。
时间序列数据的不同来源具有本地存储的维度,或者允许将数据提取到维度中的通用存储模式。
时间序列数据库(TSDB)通常原生支持维度。Prometheus也将维度存储在标签中。在诸如Graphite或OpenTSDB之类的TSDB中,使用术语 tags作为维度。
在SQL这样的表数据库中,这些维度通常是查询的GROUP BY参数。

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.
Single dimension
For example, consider a query like: 
  SELECT BUCKET(StartTime, 1h), AVG(Temperature) AS Temp, Location   FROM T
    GROUP BY BUCKET(StartTime, 1h), Location
    ORDER BY time asc
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 Temp {Location=BOS}.
Individual time series from the set are extracted by using the time typed column StartTime as the time index of the time series, the numeric typed column Temp as the series name, and the name and values of the string typed Location column to build the labels, such as Location=LGA.

表格格式的多个维度
在返回表响应的SQL或类似SQL的数据库中,附加维度通常表示为查询响应表中的列。
表格格式是一个长格式的时间序列,也称为tall。它具有重复的时间戳和位置中的重复值。在这种情况下,我们在集合中有两个时间序列,它们将被标识为Temp{Location=LGA}和Temp{Locations=BOS}。
通过使用时间类型的列StartTime作为时间序列的时间索引,使用数字类型的列Temp作为序列名称,以及字符串类型的Location列的名称和值来提取集合中的各个时间序列,以构建标签,例如Location=LGA。

Multiple dimensions
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:
In this case the labels that represent the dimensions will have two keys based on the two string typed columns Location and Sensor. This data results four series: Temp {Location=LGA,Sensor=A}, Temp {Location=LGA,Sensor=B}, Temp {Location=BOS,Sensor=A}, and Temp {Location=BOS,Sensor=B}.
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. For more information, see the documentation on [creating alerts with multiple series][create-grafana-managed-rule].

多个维度
如果更新查询以选择并按多个字符串列分组,例如group by BUCKET(StartTime,1h)、Location、Sensor,则会添加一个附加维度:
在这种情况下,表示维度的标签将有两个基于两个字符串类型列Location和Sensor的键。该数据产生四个系列:温度{Location=LGA,传感器=A},温度{Locations=LGA、传感器=B},温度{Location=BOS,传感器=A}和温度{Location=BOS、传感器=B}。
注意:Grafana中不支持多个维度映射到多个警报,而是将它们视为单个警报的多个条件。有关更多信息,请参阅[使用多个系列创建警报][创建grafana托管规则]的文档。

Multiple values
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 the developer documentation on data frames as time series.

多个值
在类似SQL的数据源的情况下,可以选择多个数字列,无论是否使用其他字符串列作为维度。例如,AVG(Temperature)AS AvgTemp、MAX(Temperation)AS MaxTemp。如果与多个维度相结合,可能会产生大量的系列。选择多个值目前仅设计用于可视化。
关于表格时间序列格式以及如何提取维度的其他技术信息,可以在作为时间序列的data frames的开发人员文档中找到。

标签:dimensions,series,Time,序列,Location,time,维度
From: https://www.cnblogs.com/route/p/17848740.html

相关文章

  • Grafana学习(3)——Introduction to time series
    Imagineyouwantedtoknowhowthetemperatureoutsidechangesthroughouttheday.Onceeveryhour,you’dcheckthethermometerandwritedownthetimealongwiththecurrenttemperature.Afterawhile,you’dhavesomethinglikethis:Temperaturedatalik......
  • python_datetime日期时间
    #!/usr/bin/python3#-*-coding:UTF-8-*-importdatetimeimporttime#时间戳ticks=time.time()print(ticks)#结构体时间{tm_year...}localtime=time.localtime(ticks)print(localtime)#格式化时间strftime=time.asctime(localtime)print(strftime)#获取当前日......
  • javaOOP(LocalDateTime日期方法)之日期的加减
    以下操作都可以用于LocalDateTime,LocalDate,LocalTime等方法本次只用了LocalDateTime测试1、加法 2、减法 ......
  • timeout 装饰器
    importfunctoolsimportsignaldeftimeout(sec):"""timeoutdecorator:paramsec:functionraiseTimeoutErrorafter?seconds"""defdecorator(func):@functools.wraps(func)defwrapped_......
  • timeSetEvent()函数定时器的使用
    1、定时器函数的使用微软公司在其多媒体Windows中提供了精确定时器的底层API支持,利用多媒体定时器可以很精确地读出系统的当前时间,并且能在非常精确的时间间隔内完成一个事件、函数或过程的调用。利用多媒体定时器的基本功能,可以通过两种方法实现精确定时。(1)使用timeGetTime()......
  • [转]手把手教你如何用golang实现一个timewheel时间轮
     转,原文:https://lk668.github.io/2021/04/05/2021-04-05-%E6%89%8B%E6%8A%8A%E6%89%8B%E6%95%99%E4%BD%A0%E5%A6%82%E4%BD%95%E7%94%A8golang%E5%AE%9E%E7%8E%B0%E4%B8%80%E4%B8%AAtimewheel/-------------------------- 手把手教你如何用golang实现一个timewheel时间轮202......
  • 解决UnboundLocalError: local variable 'time' referenced before assignment
    解决UnboundLocalError:localvariable'time'referencedbeforeassignment介绍在Python开发中,经常会遇到UnboundLocalError:localvariable'xxx'referencedbeforeassignment的错误。这个错误通常发生在在一个函数内部,尝试访问一个在函数内定义的局部变量之前。这篇文章将......
  • 【论文阅读】TimeGPT-1
    原始题目:TimeGPT-1中文翻译:TimeGPT-1发表时间:2023年10月05日平台:arXiv文章链接:http://arxiv.org/abs/2310.03589开源代码:无摘要在本文中,我们介绍了TimeGPT,这是第一个用于时间序列的基础模型,能够为训练过程中看不到的各种数据集生成准确的预测。我们根据已建立的统计、机......
  • C# 22H2之后的windows版本使用SetDynamicTimeZoneInformation设置时区失败处理
    使用SetDynamicTimeZoneInformation设置时区返回false,设置失败。使用PowerShell设置Set-TimeZone成功。///<summary>///设置本地时区///参数取值"ChinaStandardTime",即可设置为中国时区///</summary>///<paramname="timeZoneId"></param>///<retur......
  • 配置windows ntp time
    1、HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer\,将“Enabled”数值数修改为1,保存。然后services.msc重启ntptime服务。配置enable后,客户端执行ntpdate-d-uip返回toohigh  2、HKEY_LOCAL_MACHINE\SYSTEM\CurrentControl......