Hi
Could someone please help me translate below influxQL query to flux.
SELECT last(“Hours”)*60+last(“Minutes”) FROM “ebond_currentTime” WHERE $timeFilter GROUP BY time($__interval) fill(null)
Hi
Could someone please help me translate below influxQL query to flux.
SELECT last(“Hours”)*60+last(“Minutes”) FROM “ebond_currentTime” WHERE $timeFilter GROUP BY time($__interval) fill(null)
So far i have come up with the below, however it does not return any data so im assuming something with the map function is incorrect.
windowPeriod = int(v: v.windowPeriod)
myWindow = if windowPeriod < int(v: 100000000) then 1s else v.windowPeriod
from(bucket:“eBondLogs/one_day_only”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == “ebond_currentTime”)
|> filter(fn: (r) =>
r._field == “Hours” or
r._field == “Minutes”
)
|>last()
|> map(fn: (r) => ({ r with _value: r.Hours * 60 + r.Minutes}))
|>aggregateWindow(every: myWindow, timeSrc: “_start”, fn: last)
Found the solution:
import “influxdata/influxdb/schema”
windowPeriod = int(v: v.windowPeriod)
myWindow = if windowPeriod < int(v: 100000000) then 1s else v.windowPeriod
from(bucket:“eBondLogs/one_day_only”)
|>range(start: v.timeRangeStart, stop: v.timeRangeStop)
|>filter(fn: (r) => r._measurement == “ebond_log”)
|> schema.fieldsAsCols()
|> filter(fn: (r) => r.message =~ /Order cannot proceed (limitTotalQuanitiyExecuted:/ and r.path =~ //var/eBondTS/log/ebond-buyback.log/)
|>rename(columns: {message: “_value”})
|>aggregateWindow(every: myWindow, timeSrc: “_start”, fn: count)
|> map(fn: (r) => ({r with
_field: “Buyback limitTotalQuanitiyExecuted”
}))