database - 在 influxdb 0.9.x 中合并时间序列

标签 database time-series influxdb nosql-aggregation nosql

我有一个系统需要监控其指标。为此,我使用 grafana + influxdb。我目前使用的influxdb版本是0.9.x。

我希望能够计算一些统计数据。我的用例非常简单:

  1. 我想从几个时间序列源中进行选择查询。
  2. 我想在选择查询中使用 group by 语句来对我的数据进行分组。
  3. 最后,我想找到每个组内的平均值。

我的查询如下:

SELECT mean(value) FROM /namespaces_.*.amount/ where time < "2015-10-21T14:16:18Z" group by time(1m);

看似微不足道,其实有点棘手。我得到这样的东西:

name: namespaces_1.amount
------------------------------------------------------------
time            mean
1970-01-01T00:00:00Z    0.8877630461283463

name: namespaces_2.amount
------------------------------------------------------------
time            mean
1970-01-01T00:00:00Z    0.6982870635693408

根据 influxdb 文档,您可以从多个来源获取数据。换句话说,您可以在 FROM 关键字后写入多个数据系列。而我想合并它们并对合并的系列进行处理。在 influxdb 0.8.x 中有 merge 功能,它使您能够混合数据源。 然而,在 influxdb 0.9.x 中既没有合并也没有连接操作。

引用:https://influxdb.com/docs/v0.9/concepts/08_vs_09.html

In InfluxDB 0.9 neither the MERGE nor JOIN operations are supported. The MERGE operation is no longer needed. All series within a measurement are automatically merged when queried, unless explicitly excluded by tags in the WHERE clause.

所以,当你写的时候

SELECT mean(value) FROM merge(/namespaces_.*.amount/) where time < "2015-10-21T14:16:18Z" group by time(1m);

你得到一个空的结果...

因此,我的问题是:使用 influxdb 0.9.x 工具从多个时间序列源中选择数据、合并它们、按某些条件分组并将聚合函数应用于每个组的方法是什么

最佳答案

what is the way to select data from multiple time series sources, merge them, group by some criteria and apply aggregation function to each group using tools of influxdb 0.9.x?

正如我在 mailing list 上回复的那样,您需要正确构建您的模式.

在 InfluxDB 0.9 中,默认合并给定度量下的所有系列,并在 WHERE 子句中过滤 using 标签。

不同测量下的系列不能合并为一个结果。

您有许多测量值,每个测量值有一个系列。您应该有几个测量值,每个测量值有很多系列。查看0.8 vs 0.9 docs .

关于database - 在 influxdb 0.9.x 中合并时间序列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33264655/

相关文章:

sql - 如何将 SELECT 语句的一部分放入 Postgres 函数中

r - R 版本 3.2.0 和 R 版本 3.2.2 中 d=1 的 auto.arima 的不同结果

MySQL 常量值索引

R:如何在重叠的时间段内取平均值

python Pandas : transform start and end datetime range (stored as 2 columns) to individual rows (eqpt utilisation)

node.js - InfluxDB [错误:没有可用的主机]

influxdb - 涌入: all old data got deleted after applying retention policy

Influxdb、Grafana 检测并去除异常值

python - python中每列的高效多重计算

mysql - 在具有不同结构(模式)的数据库之间复制期间转换数据