grafanagrafana-variablegrafana-templating

grafana interval variable not dynamic


I'm making dashboard and as a reference I'm using already existing one, that dashboard has $interval variable which has such a settings . and it used for example in the pane title, like this Top routes for [$interval], and in actual dashboard it replacing $interval variable in title depends on selected range.

So in my dashboard I made identical variable, and add it also to pane title, but for some reason it's not dynamic for me at all, it always showing 1 minute...

Also here is a comparison of JSON parts of dashboard related to that variable. Referenced dashboard:

{
        "auto": true,
        "auto_count": 1,
        "auto_min": "5m",
        "current": {
          "selected": false,
          "text": "auto",
          "value": "$__auto_interval_interval"
        },
        "description": null,
        "error": null,
        "hide": 2,
        "label": "interval",
        "name": "interval",
        "options": [
          {
            "selected": true,
            "text": "auto",
            "value": "$__auto_interval_interval"
          },
          {
            "selected": false,
            "text": "1m",
            "value": "1m"
          },
          {
            "selected": false,
            "text": "10m",
            "value": "10m"
          },
          {
            "selected": false,
            "text": "30m",
            "value": "30m"
          },
          {
            "selected": false,
            "text": "1h",
            "value": "1h"
          },
          {
            "selected": false,
            "text": "6h",
            "value": "6h"
          },
          {
            "selected": false,
            "text": "12h",
            "value": "12h"
          },
          {
            "selected": false,
            "text": "1d",
            "value": "1d"
          },
          {
            "selected": false,
            "text": "7d",
            "value": "7d"
          },
          {
            "selected": false,
            "text": "14d",
            "value": "14d"
          },
          {
            "selected": false,
            "text": "30d",
            "value": "30d"
          }
        ],
        "query": "1m,10m,30m,1h,6h,12h,1d,7d,14d,30d",
        "refresh": 2,
        "skipUrlSync": false,
        "type": "interval"
      },

and here is mine:

{
        "auto": true,
        "auto_count": 1,
        "auto_min": "5m",
        "current": {
          "selected": false,
          "text": "1m",
          "value": "1m"
        },
        "description": null,
        "error": null,
        "hide": 2,
        "label": "interval",
        "name": "interval",
        "options": [
          {
            "selected": false,
            "text": "auto",
            "value": "$__auto_interval_interval"
          },
          {
            "selected": true,
            "text": "1m",
            "value": "1m"
          },
          {
            "selected": false,
            "text": "10m",
            "value": "10m"
          },
          {
            "selected": false,
            "text": "30m",
            "value": "30m"
          },
          {
            "selected": false,
            "text": "1h",
            "value": "1h"
          },
          {
            "selected": false,
            "text": "6h",
            "value": "6h"
          },
          {
            "selected": false,
            "text": "12h",
            "value": "12h"
          },
          {
            "selected": false,
            "text": "1d",
            "value": "1d"
          },
          {
            "selected": false,
            "text": "7d",
            "value": "7d"
          },
          {
            "selected": false,
            "text": "14d",
            "value": "14d"
          },
          {
            "selected": false,
            "text": "30d",
            "value": "30d"
          }
        ],
        "query": "1m,10m,30m,1h,6h,12h,1d,7d,14d,30d",
        "refresh": 2,
        "skipUrlSync": false,
        "type": "interval"
      }

So depends on json in selected section in both cases we have selected:false, but for some reason in my dashboard 1m is default but should be auto.

What I'm doing wrong, am I miss something. Thank you!


Solution

  • Your variable is hidden, so you don't see what is selected. This config:

            "current": {
              "selected": false,
              "text": "1m",
              "value": "1m"
            },
    

    defines that default value is 1m.

    You need to have auto value as default value:

            "current": {
              "selected": false,
              "text": "auto",
              "value": "$__auto_interval_interval"
            },
    

    then auto will be default value (unless you will specify variable value explicitly in the URL as parameter)