Grafana and using variables to display JSON data from Infinity Datasource - New User warning!

  • What Grafana version and what operating system are you using?

Grafana v9.1.5 on Centos7

  • What are you trying to achieve?
    I am a complete Grafana Noob so apologies in advance to the more expert users.

I have been given some json output (via file) which I have been tasked with displaying in Grafana. I am currently using the Infinity Datasource as it was the first one I saw that could reference JSON from file.

An example of the code is below:

"[{"Job":"6321893698f7860001fe0ace","Type":0,"Date":"2022-09-14T12:24:14.845+00:00","Slave":"IP-0A71126E","Task":169,"Title":"Render Log","JobName":"Test Job","JobUser":"test.user1","Plugin":"Cinema4DBatch","Frames":"169-169","TaskStartTime":"0001-01-01T00:00:00Z","TaskTime":3092,"LogErr":"","AverageCpu":50,"PeakCpu":96,"AverageRam":16397250560,"RamAvgPer":49,"PeakRam":16816889856,"RamPeakPer":50,"UsedClock":34364904,"TotalClock":68729808,"_id":"6321c7ef3bb94512bcb45cfd"},{"Job":"6321893698f7860001fe0ace","Type":0,"Date":"2022-09-14T12:23:22.785+00:00","Slave":"IP-0A711206","Task":168,"Title":"Render Log","JobName":"Test Job","JobUser":"test.user1","Plugin":"Cinema4DBatch","Frames":"168-168","TaskStartTime":"0001-01-01T00:00:00Z","TaskTime":3104,"LogErr":"","AverageCpu":54,"PeakCpu":98,"AverageRam":16122632192,"RamAvgPer":48,"PeakRam":16551948288,"RamPeakPer":49,"UsedClock":37176136,"TotalClock":68844696,"_id":"6321c7bb5f274b07308ae508"},{"Job":"6321893698f7860001fe0ace","Type":0,"Date":"2022-09-14T12:19:40.112+00:00","Slave":"IP-0A7112B3","Task":167,"Title":"Render Log","JobName":"Test Job","JobUser":"test.user1","Plugin":"Cinema4DBatch","Frames":"167-167","TaskStartTime":"0001-01-01T00:00:00Z","TaskTime":3112,"LogErr":"","AverageCpu":51,"PeakCpu":99,"AverageRam":16078097408,"RamAvgPer":48,"PeakRam":16574046208,"RamPeakPer":49,"UsedClock":35453240,"TotalClock":69516160,"_id":"6321c6dc5d5ea70c6c6b306d"},

  • How are you trying to achieve it?

I can generate a table of the data, no issue. What I would like to achieve is being able to visualize/graph the data by using a variable drop down for Task and then display the Task Time and perhaps some additional metrics like AverageCPU for the applicable task.

  • What happened?
    I am able to generate what looks like accurate visualizations but I am completely stumped on how I can tell that visualisation to use a variable for selection

  • What did you expect to happen?
    Nothing yet, as I am stumped!

  • Can you copy/paste the configuration(s) that you are having problems with?
    I can on request, not entirely sure exactly what paste is needed but can provide if required.

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    Nothing that I have noticed

1 Like


  1. First the variable for the drop down to choose from

  1. The infinity UQL query using jsonata

  2. Result

@yosiasz Thank you so much, this helped massively and has enabled me to present the data required.

One issue I had was that I was unable to select multiple columns using the uql query (your example has project “AverageCpu”, “TaskTime”, “Title” on one line)

I ended up setting multiple uql queries for the columns required

It has also opened up other possibilities to me. I wanted to make a panel/dashboard that provides an overall total for all “JobName” which gives the total task time (and other metrics maybe) for any jobs that are relevent to the specified “JobName”

So essentially for the json data total the required metrics per JobName. A variable selection on the dashboard for one/multiple/all JobName

In my example json data provided there is only one JobName. The actual data is the same format/structure but multiple JobNames

Any help would be appreciated!

1 Like

Very good. Now that you understand how to :fish: I would recommend you read uql documentation for that plugin.

Also discussion threads in github