I’m trying to query the top 5 project with highest usage.
My query is :
from (bucket: "test_repo")
|> range(start: -10d)
|> drop("columns": ["user", "version", "resource", "_stop", "_start"])
|> filter(fn: (r) =>
r._measurement == "image_pull" and
r._field == "cnt"
)
|> sum()
|> sort("columns" : ["_value"])
|> limit(n : 5)
Last 3 rows of the result returned by influx query
is :
Table: keys: [_field, _measurement, project]
_field:string _measurement:string project:string _value:int
---------------------- ---------------------- ---------------------- --------------------------
cnt image_pull zbentxoml 49
Table: keys: [_field, _measurement, project]
_field:string _measurement:string project:string _value:int
---------------------- ---------------------- ---------------------- --------------------------
cnt image_pull zedge-devid 4283
Table: keys: [_field, _measurement, project]
_field:string _measurement:string project:string _value:int
---------------------- ---------------------- ---------------------- --------------------------
cnt image_pull zfaas 4
It is still sorted by project name and more than 5 rows are returned.