Expression in Query

Hello, I have developed a custom backend data plugin. Using this plugin I am able to return time series data that has float64 as its data type. When I create a panel with two queries A and B then attempt to use an expression to combine $A + $B I expect that I will get a new time series data that is a added to b. In stead the there is no trend returned at all.

In the Grafana documentation it says:

If both $A and $B are time series data, then the operation between each value in the two series is performed for each time stamp that exists in both $A and $B . The Resample operation can be used to line up time stamps. ( Note: in the future, we plan to add options to the Math operation for different behaviors).

Am I doing something incorrect in the data that is getting returned by the plugin or have I messed up the configuration?

I am using Grafana v7.4.2 (29e75ad97b).

Thanks for the help.

The problem is likely that your two series are not sharing any common timestamps, which means the expressions are not able to figure out how to add them. The easiest way to solve this is by Resampling the data.

For each series, create a new Expression and select the Resample operation. Set the Resample to, Downsample and Upsample to the same values for each one. These new series will now have common timestamps that math operations can work with.

Finally, update your Math Expression to add the Resampled expressions instead and it should work. Optionally, you can hide the two resampled series so they do not display on the graph.

This topic was automatically closed after 365 days. New replies are no longer allowed.