07 Dec 2023 03:09 PM - last edited on 05 Aug 2024 10:07 AM by GosiaMurawska
I have tried simple single value via timeseries cpu=avg(dt.host.cpu.usage) data.
I had learned that output of timeseries is array, so single value is not possible (blank widget without any info, but it shows trend at least, when i select timeframe/interval as input data).
Another try was timeseries cpu=avg(dt.host.cpu.usage)|fields cpuavg=arrayAvg(cpu).
This produces nice single value but doesn't allow to visualize sparkline, nor trends (as it's only single number obviously).
I had tried to push array as well via timeseries cpu=avg(dt.host.cpu.usage)|fields cpu,cpuavg=arrayAvg(cpu), but sparkline does not allow to use cpu array as data source (shows None as record field only option).
I know it's only early access, but any hints how to achieve such a simple task ? (single value with sparkline and trend as in classic metric explorer)
08 Aug 2024 11:30 AM
I think your approach is almost perfect but, when you use fields you limit the amount of fields returned in the query. You can directly add the extra calculation with fieldsAdd.
I believe the following query should fit your needs and let you visualize everything in a single value tile:
timeseries cpu=avg(dt.host.cpu.usage)
| fieldsAdd cpuAvg=arrayAvg(cpu)