I am running InfluxDB 2.0 and running many tasks as well and everything is running fine.
I am using the group function in my flux query to group the data based on the tag columns.
sample flux query for my task:
option task = {
name: "task_name",
every: 1h,
offset: 5m
}
f = (a, b) =>
(from(bucket: a)
|> range(start: -51m)
|> filter(fn: (r) => r["_measurement"] == "provided")
|> filter(fn: (r) => r["_field"] == "provided")
|> max(column: "_value")
|> duplicate(as: "_time", column: "_stop")
|> window(every: inf)
|> group(columns: ["tag_name1"])
|> group(columns: ["tag_name2"])
|> map(fn: (r) =>
({
time: r._time,
_measurement: "provided",
_field: "provided",
tag_name1: r.tag_name1,
tag_name2:r.tag_name2,
_value: r._value,
}))
|> to(bucket: b, org: "org_name", timeColumn: "time"))
f(a: "provided", b: "provided")
f(a: "provided", b: "provided")
It’s working and I am getting the output in different measurements. Here I have used two tag_Columns for grouping the data but I want to use all my tag_columns at once.
I have around 10 tag_columns
I am using the below code for getting all tags
import "influxdata/influxdb/schema"
data = schema.measurementTagKeys(
bucket: "provided",
measurement: "provided"
)
|> yield(name:"value")
Now I want to pass all the tag_columns in the group function as a list like below code:
f = (a, b) =>
(from(bucket: a)
|> range(start: -51m)
|> filter(fn: (r) => r["_measurement"] == "provided")
|> filter(fn: (r) => r["_field"] == "provided")
|> max(column: "_value")
|> duplicate(as: "_time", column: "_stop")
|> window(every: inf)
|> group(columns: [all tag column list])
|> map(fn: (r) =>
({
time: r._time,
_measurement: "provided",
_field: "provided",
all_tag_columns: r.all_tag_columns,
_value: r._value,
}))
|> to(bucket: b, org: "org_name", timeColumn: "time"))
Is there any way I can achieve the above problem?
Thanks