__value variables assigned incorrectly in state timeline with multiple queries

  • What Grafana version and what operating system are you using?
    v9.3.0 in Ubuntu 18.04.4

  • What are you trying to achieve?
    I am trying to provide data links based on values in a state timeline.

  • How are you trying to achieve it?
    I have two queries to a PostgreSQL database. The data links are created using overrides for each query with values given by ${__value.text} or ${__data.fields[1]} (either variable gives identical behavior).

  • What happened?
    Variable values are incorrectly given as though the two tables from the queries have been flattened into a single table. The first values shown in the image below (e.g. 031615) have correct variable values, while later values have incorrect values, such as ‘031648’ having a data link value of ‘031627’.
    image

  • What did you expect to happen?
    I expected the variable to have the same value as is shown in the stat panel. In the image above, that would mean the panel and variable both have the value ‘031648’. I’ve previously created this panel using an influxDB datasource and seen the expected behavior. The panel also behaves as expected if either query is disabled.

  • Can you copy/paste the configuration(s) that you are having problems with?
    See above.

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

  • Did you follow any online instructions? If so, what is the URL?
    PostgreSQL data source | Grafana documentation
    Configure data links | Grafana documentation
    State timeline | Grafana documentation