Prometheus to flux

Hi,

I want rewrite prometheus query to flux language
In prometheus query is

sum(increase(Camelmetrics{camelContext=\"$camelContext\"}[60s]))/60\n

I try write in flux language

from(bucket: "db/autogen")
  |> range(start:  v.timeRangeStart)
  |> filter(fn: (r) =>
      r._measurement == "Camelmetrics" and 
      r._field == "value" and
      r.app =~ /${app:regex}/ and 
      r.routeId =~ /${route:regex}/ )
  |> group(columns: ["_measurement","app","routeId"])
  |> drop(columns:[ "_field"])
  |> increase()
  |> derivative()
  |> aggregateWindow(every:  v.windowPeriod, fn: mean)

but this query if it is longer than 24h return derivative: derivative found out-of-order times in time column

Please help me