One graph in repeat for is rendering 'No data'

  • What Grafana version and what operating system are you using?
    v8.1.5
    Debian 10, kernel 5.10.17-v8+

  • What are you trying to achieve?
    I’m using the “repeat for variable” function to repeat a row for all valid keys in my variable ‘city’. It works perfectly except for one graph in the repeated rows rendering No data. I can inspect the data for the repeated graph and see that it’s correctly sourcing the data it’s supposed to render. All other graphs that are near identical are working as expected.

  • How are you trying to achieve it?

from(bucket: "hacks")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "openweathermap")
  |> filter(fn: (r) => r["_field"] == "weather_0_description")
  |> filter(fn: (r) => r["name"] == "${city}")
  |> last()
  |> yield(name: "weather_0_description")

Inspect > Data for the graph that renders No data returns few clouds.

Time                                   weather_0_description {coord_lat="55.6059", coord_lon="13.0007", host="ai27", id="2692969", name="Malmo", sys_country="SE", url="https://api.openweathermap.org/data/2.5/weather?q=Malmö,SE&units=metric&appid=cd349a6bd8731077a79798a8e66f9bd3"}
2021-10-08 08:43:42                    few clouds
  • What did you expect to happen?
    In the repeated row, the graph Weather conditions should render the string few clouds instead of No data

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

{
  "id": 246,
  "gridPos": {
    "h": 6,
    "w": 4,
    "x": 16,
    "y": 8
  },
  "type": "stat",
  "title": "Weather conditions",
  "scopedVars": {
    "city": {
      "text": "Malmo",
      "value": "Malmo",
      "selected": false
    }
  },
  "datasource": "InfluxDB",
  "pluginVersion": "8.1.5",
  "fieldConfig": {
    "defaults": {
      "thresholds": {
        "mode": "absolute",
        "steps": [
          {
            "color": "green",
            "value": null
          },
          {
            "color": "red",
            "value": 80
          }
        ]
      },
      "mappings": [],
      "color": {
        "mode": "thresholds"
      }
    },
    "overrides": []
  },
  "options": {
    "reduceOptions": {
      "values": false,
      "calcs": [
        "lastNotNull"
      ],
      "fields": "/^weather_0_description \\{coord_lat=\"57\\.7072\", coord_lon=\"11.9668\", host=\"ai27\", id=\"2711537\", name=\"Gothenburg\", sys_country=\"SE\", url=\"https://api.openweathermap.org/data/2.5/weather\\?q=Göteborg,SE\\&units=metric&appid=cd349a6bd8731077a79798a8e66f9bd3\"\\}$/"
    },
    "orientation": "auto",
    "text": {},
    "textMode": "auto",
    "colorMode": "value",
    "graphMode": "area",
    "justifyMode": "auto"
  },
  "targets": [
    {
      "query": "from(bucket: \"hacks\")\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => r[\"_measurement\"] == \"openweathermap\")\n  |> filter(fn: (r) => r[\"_field\"] == \"weather_0_description\")\n  |> filter(fn: (r) => r[\"name\"] == \"${city}\")\n  |> last()\n  |> yield(name: \"weather_0_description\")",
      "refId": "A"
    }
  ],
  "repeatPanelId": 240,
  "repeatIteration": 1633675537139,
  "repeatedByRow": true
}
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No errors in the UI, can’t find anything relevant while monitoring logs while clicking in the dashboard/graph.

  • Did you follow any online instructions? If so, what is the URL?
    I imported Open Weather Map dashboard for Grafana | Grafana Labs but had to manually re-craft the queries since I’m using influxdb2 and that dashboard was written for influxdb1

I got this working when I reconfigured the query to only keep the _value column and the Value options so that _value is included in the fields panel.

from(bucket: "hacks")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "openweathermap")
  |> filter(fn: (r) => r["_field"] == "weather_0_description")
  |> filter(fn: (r) => r["name"] == "${city}")
  |> keep(columns: ["_value"])

1 Like