Need help getting status history set up for test results

  • I’m on Grafana 9.4.7 on Windows

  • I am trying to display test results from test runs. I have data that includes a test name, a test result, and a timestamp rounded down to the start of the day. Results are given once a day, so I only need to be as granular as once a day

  • Right now I am using influxdb to store data like this:

0:Object

name:“test_results”

columns:Array[3]

0:“time”

1:“result”

2:“test_name”

values:Array[20]

0:Array[1682035200000,0,test_name_c]

1:Array[1682035200000,1,test_name_b]

2:Array[1682035200000,2,test_name_c]

In this case results can be 0 - pass, 1 - rerun pass, 2 - rerun fail

  • I can’t seem to get any of the data to show up in the status history panel

  • What I would like to have happen is to have test names on the y axis on the left, and dates on the x axis at the bottom, and each cell where these values intersect will be a result, like this

test_name_a        0                  1
test_name_b        1                  1
test_name_c        2                  0
                 April 21        April 22

But instead of the number it would be green for 0, yellow for 1, and red for 2

I have no idea if a status history panel is the right way to do this, or if I should be using a different panel, or maybe be organizing my data differently. Here is how I am setting up each data entry in python:

{"measurement": "test_results", "tags": {"test_name": test}, "time": int(adjusted_timestamp),"fields": {"result": 0}}
  • The data is getting to influxdb just fine, and my query is working. Query is:
    SELECT "time", "result", "test_name" FROM tests.."test_results" LIMIT 20
    I have LIMIT 20 on there because otherwise it shows the error that there are too many data points, which I’m hoping to make this a very large, scrollable panel with a lot of test history in it.

Would appreciate any help, kind of lost on where to go from here.

Welcome @jmorg to the Grafana forum.

Can you paste the above query into Grafana with the following settings to see if anything shows up?

I definitely am getting results:

Just now sure how to get the values I am getting to display properly in the status history.

And when you change the visualization from Table to Status history what do you see?

This is all I’m getting:


And what I’m hoping for is something like this:
https://play.grafana.org/d/qD-rVv6Mz/6-state-timeline-and-status-history?orgId=1&from=1682419089427&to=1682440689427&viewPanel=68

Hi @jmorg

Let’s go back to the query. It looks like one single data point (“0” at 2023-04-20 17:00:00.000). There is also a drop down selector at the bottom visible (test_results_result). What other options are in that selection box?

image

image

The other option in the dropdown is test_name:

Are there any values (0, 1, 2) in the far right? Your screenshot is cropped.

In any event, the timestamp is always the same, so any sort of time series visualization in Grafana (such as Status History) will not display anything useful. Do you know why the timestamp is always the same? Do you have the time selector for something wide, e.g. 12 hours?

The time stamp is the same because this is just a single batch of information. I want the results to be daily results, with one result per day for each of the tests on the list.

The screenshot is cropped because I do not want to show the names of the tests, but that is all there is. A column of timestamps and a column of test names.

Do I need to structure my data differently? This is the main concern I have, I have no idea how to format my data in influx to make it status history friendly.

I’m hoping to get something like this:

I have all the data for it. I just don’t know how to properly store that data in influx to make it show up in grafana. But I have a list of test names, the dates that they ran on, and the results they had.

Can you try splitting your query up into multiple queries, where each returns the values for an individual system?

Example with dummy CSV values:

OK, I added more data and I got things working with a query for a single test:

But once I add another query with another test name I get an unexpected error

Also, I have thousands of tests I could potentially list, and I would rather make this so it can dynamically create a different row for each test instead of having to create a new query for every single test.

What is the error? Does it say anything if you hold the mouse above the red exclamation mark in the upper left?

Have you considered using variables (e.g. “Test Name”) in a drop down that you can embed into your InfluxQL query?

The variable name is a good idea, and maybe I need to shift my focus a little from having massive board to an on-demand board for a specific test.

The only error I get in the corner with the red mark is “Failed to fetch”. Not sure why it works with one request, but not two :frowning:

Just coming back here to say thanks for your help @grant2 I wasn’t able to get multiple rows, but instead used your suggestion to have a variable to specify a single test. That will work for what I need. Your suggestions really helped, thanks again!