infuxdb2:如何在同一桶中的不同测量中下样本数据?
我想通过每月数据创建相同桶的聚合测量。目前,我在此查询中执行了一个任务:
import "strings"
option task = {name: "MTU Monthly", every: 1d}
from(bucket: "my_bucket")
|> range(start: 1464943523, stop: 1654244985)
|> filter(fn: (r) => r._measurement == "machine_time_utilization")
|> aggregateWindow(every: 1mo, fn: sum)
|> map(
fn: (r) =>
({r with _measurement:
strings.replaceAll(
v: r._measurement,
t: "machine_time_utilization",
u: "machine_time_utilization_monthly",
),
}),
)
|> to(bucket: "my_bucket")
我不喜欢使用strings.replaceall
进行操作。有没有办法做得更好?
I would like to create aggregation measurement into same bucket with monthly data. At the moment I have a task with this query:
import "strings"
option task = {name: "MTU Monthly", every: 1d}
from(bucket: "my_bucket")
|> range(start: 1464943523, stop: 1654244985)
|> filter(fn: (r) => r._measurement == "machine_time_utilization")
|> aggregateWindow(every: 1mo, fn: sum)
|> map(
fn: (r) =>
({r with _measurement:
strings.replaceAll(
v: r._measurement,
t: "machine_time_utilization",
u: "machine_time_utilization_monthly",
),
}),
)
|> to(bucket: "my_bucket")
I don't like how it is done by using strings.replaceAll
. Is there a way how to do it better?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果需要在记录中设置静态值,请使用 set 函数,即。
If you need to set static value in the records, use set function, ie.