Can query use data from another query?

Hello everyone, I am a newbie in Grafana and just started to use and learn Grafana. The following are the problems I encountered. I hoping to get some point or advice.

  • What Grafana version and what operating system are you using?
    I’m running Grafana on Docker, and Grafana’s version is 10.3.3.

  • What are you trying to achieve?
    I have several data save in Redis. The keys on Redis are like Process:01, Process:02, … These keys contain a JSON structured string, like: {"Info": "Some Process Info", "Start": "2024-03-04 01:00:00", "End": "2024-03-04 02:00:00"}.
    At the same time, I also have some data save in InfluxDB, such as the counter or power consumption to each process.
    I want to calculate the change in InfluxDB’s data for each process, such as how much the counter has increased.
    Then, through panel repeat function, display the detailed information and counter changes of each process in tables or charts.

  • How are you trying to achieve it?

  1. Set a ProcessKey in dashboard variables. It will execute KEYS Process:* in Redis to obtain all need keys.
  2. Create a panel. This panel will execute Redis GET based on ProcessKey for the detailed information of each process. And display information by table.
  3. Let this panel repeat based on ProcessKey
  4. [Stuck here] In the same panel, I hope to set the InfluxDB query based on Start and End in Redis Process:01 data and repeat on 02, 03 …

Part of IndluxDB query for example:

from(bucket: "myBucket")
  |> range(start: Process:01.Info.Start, stop: Process:01.Info.End)
  • What did you expect to happen?
    In my expectation, I want to be able to display one or more tables (best in one table and several rows).
    This table will display the data of all Processes in Redis, and use the start and end times saved in Redis, to get the data of the corresponding time range from InfluxDB and calculate it. After the calculation is completed, it will be merged into the same table and displayed together.

So the influx has process list and time ranges?

In my environment, InfluxDB save prodcess id as InfluxDB measurement, data label (like counter and powerConsumption) as InfluxDB tag, and no time range in InfluxDB.
So I am expecting to get Start and End time from Redis Process:[id] data and use it for IndluxDB query.

Please post sample data of each

Csv for influx

Json for elastic

InfluxDB

#group,false,false,true,true,false,false,true,true,true
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,double,string,string,string
#default,distinct,,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement,label
,,0,2024-03-05T00:34:25.126680962Z,2024-03-05T01:34:25.126680962Z,2024-03-05T01:22:14.79443251Z,1,value,01,counter
,,0,2024-03-05T00:34:25.126680962Z,2024-03-05T01:34:25.126680962Z,2024-03-05T01:22:18.044999547Z,2,value,01,counter
,,0,2024-03-05T00:34:25.126680962Z,2024-03-05T01:34:25.126680962Z,2024-03-05T01:22:21.381544029Z,3,value,01,counter
,,0,2024-03-05T00:34:25.126680962Z,2024-03-05T01:34:25.126680962Z,2024-03-05T01:22:27.669863739Z,4,value,01,counter
,,0,2024-03-05T00:34:25.126680962Z,2024-03-05T01:34:25.126680962Z,2024-03-05T01:22:32.8405497Z,5,value,01,counter
,,0,2024-03-05T00:34:25.126680962Z,2024-03-05T01:34:25.126680962Z,2024-03-05T01:23:15.961424675Z,6,value,01,counter
,,0,2024-03-05T00:34:25.126680962Z,2024-03-05T01:34:25.126680962Z,2024-03-05T01:34:01.741916299Z,7,value,01,counter
,,0,2024-03-05T00:34:25.126680962Z,2024-03-05T01:34:25.126680962Z,2024-03-05T01:34:04.882345055Z,8,value,01,counter
,,0,2024-03-05T00:34:25.126680962Z,2024-03-05T01:34:25.126680962Z,2024-03-05T01:34:09.274986875Z,9,value,01,counter
,,0,2024-03-05T00:34:25.126680962Z,2024-03-05T01:34:25.126680962Z,2024-03-05T01:34:12.078906013Z,10,value,01,counter

Redis

Key: Process:01

{
  "Info": "Some Process Info",
  "Start": "2024-03-05 01:30:00",
  "End": "2024-03-05 01:40:00"
}

Expect Table

Process ID Info Start End Counter
01 Some Process Info 2024-03-05 01:30:00 2024-03-05 01:40:00 4
02
1 Like