I am rendering a table panel view with raw data metric using elastic-search data source and it successfully display the table.
The requirement is to perform some operation on one column field of the table (returnTime) which is having a date format something like “2023-11-20 10:00:00” and I need a new column like “Delay” which basically does a simple math
now() - toDateTime(returnTime)
To achieve this, I was using Transform -> Add field from calculation -> Binary Operation feature of grafana and it gives me two dropdowns to select the field or number. But I guess I am unable to use “toDateTime” and “now” functions in the dropdowns.
Can anyone please help me on this. Any help would be highly appreciated.
for more control over these types of additional columns and calculations I would go with infinity plugin that works nicely with elastic search then using jsonata you can do pretty much anything you want.
@yosiasz Sorry I have a query, JSONata does not seems to be a plugin how it will work with the Infinity plugin which you mentioned ? So you mean Infinity plugin can’t support floor, ceil methods it seems ?
Because as mentioned earlier I need to control the column data in Grafana itself by modifying/adding a column by transforming a date of format “2023-11-20 10:00:00” to hours by using below formulae in Grafana itself
Logic is something like below which I need in Grafana with some Plugin since currently Table plugin doesn't handle it:
floor(now() - toDateTime(returnTime) / 3600)
@yosiasz I was able to now bring the delay in hours but I facing one issue I need to convert the delay hours to some alias based on a calculation like if it is b/w
* Between 0 and 24 display as '0-24h'
* Between 24 and 48 display as '24-48h'
* Between 48 and 72 display as '48-72h'
* Greater than 72 as '>72h'
For the above I am using below query but it does not seems to be working.