是否可以在InfluxDB中定义自定义聚合?

编程入门 行业动态 更新时间:2024-10-15 22:22:46
本文介绍了是否可以在InfluxDB中定义自定义聚合?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我目前正在使用(滥用?)Postgres存储时间序列数据,并且鉴于现在正在使用的数据量,我需要迁移到支持连续查询和保留策略的真实时间序列数据库.我正在查看InfluxDB,唯一让我退缩的是定义自定义聚合的能力.我目前在Postgres中定义了一个自定义聚合,该聚合根据一个表中的数据计算加权平均值,权重由其中一列中的值确定.例如,我有一个 score 列,其值在1到9之间.在计算加权平均分数时,如果分数在4到6之间,则将分数乘以10;如果在4到6之间,则将其乘以1000.在计算平均值之前是7和9.

I'm currently using (abusing?) Postgres to store time-series data, and given the amount of data now being consumed I'm needing to migrate over to a true time-series database that supports continuous queries and retention policies. I'm looking at InfluxDB, and the only thing holding me back is the ability to define custom aggregates. I currently have a custom aggregate defined in Postgres that calculates a weighted average for data in a table based, with weights being determined by the value in one of the columns. For example, I have a score column with values between 1 and 9. When calculating the weighted average score, I multiply the score by 10 if it's between 4 and 6, and multiply it by 1,000 if it's between 7 and 9 before calculating the average.

是否可以在InfluxDB中做类似的事情?

Is it possible to do something similar in InfluxDB?

推荐答案

目前,InfluxDB不允许在InfluxQL中使用用户定义的功能.

At the moment InfluxDB doesn't allow for user defined functions within InfluxQL.

您可以同时使用InfluxDB和 Kapacitor 来实现您要执行的操作.特别是,您将使用Kapacitor中的用户定义的功能节点进行定义加权平均UDF,然后将UDF的结果写回到InfluxDB.

You could use both InfluxDB and Kapacitor together to achieve what you're trying to do. Particularly you'd use the User Defined Function Node in Kapacitor to define a weighted average UDF and then write the results of the UDF back into InfluxDB.

更多推荐

是否可以在InfluxDB中定义自定义聚合?

本文发布于:2023-10-26 14:07:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1530361.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   定义   InfluxDB

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!