I come here because on the Prometheus forum there is no answer.
I have a request that I’m having difficulty converting from Flux to PromQL. I have two identical databases, one in InfluxDB and the other in Prometheus. Currently, I am trying to see if I can transfer all of my queries to PromQL. I have some queries where I can’t find the solution, and I hope you can help me.
Here is my query in Flux:
from(bucket: "showroom")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["deviceType"] == "TIC")
|> filter(fn: (r) => r["_field"] == "EAP_s")
|> map(fn: (r) => ({ _value:float(v: r._value) * 365.0 * 3.4 / 4.0, _time:r._time, _field:r.device_id + "/" + r.PTCOUR1}))
|> aggregateWindow(every: 1d, fn: spread, createEmpty: false)
|> group(columns: ["_time"])
|> sum()
|> group(columns: ["table"])
|> mean()
|> map(fn: (r) => ({ Class: r._value}))
This part in Flux corresponds to the metric “TIC_EAP_s” in Prometheus:
from(bucket: "showroom")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["deviceType"] == "TIC")
|> filter(fn: (r) => r["_field"] == "EAP_s")