{ "kind": "Dashboard", "apiVersion": "dashboard.grafana.app/v2beta1", "metadata": { "name": "variable-conversions-test", "labels": { "test": "variable-conversions" } }, "spec": { "annotations": [], "cursorSync": "Off", "description": "Testing all variable types and transformations", "editable": true, "elements": {}, "layout": { "kind": "GridLayout", "spec": { "items": [] } }, "links": [], "liveNow": false, "preload": false, "tags": [ "test", "variables" ], "timeSettings": { "timezone": "browser", "from": "now-6h", "to": "now", "autoRefresh": "", "autoRefreshIntervals": [ "5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d" ], "hideTimepicker": false, "fiscalYearStartMonth": 0 }, "title": "Variable Conversions Test Dashboard", "variables": [ { "kind": "DatasourceVariable", "spec": { "name": "datasource_var", "pluginId": "prometheus", "refresh": "onDashboardLoad", "regex": "", "current": { "text": "Prometheus", "value": "prometheus-uid" }, "options": [ { "selected": true, "text": "Prometheus", "value": "prometheus-uid" }, { "selected": false, "text": "InfluxDB", "value": "influx-uid" } ], "multi": false, "includeAll": false, "label": "Data Source", "hide": "dontHide", "skipUrlSync": false, "description": "Select a data source", "allowCustomValue": true } }, { "kind": "QueryVariable", "spec": { "name": "query_var", "current": { "text": [ "All", "localhost:9090" ], "value": [ "$__all", "localhost:9090" ] }, "label": "Instance", "hide": "hideLabel", "refresh": "onTimeRangeChanged", "skipUrlSync": false, "description": "Available instances", "query": { "kind": "DataQuery", "group": "prometheus", "version": "v0", "datasource": { "name": "existing-ref-uid" }, "spec": { "__legacyStringValue": "label_values(up, instance)" } }, "regex": "/.*9090.*/", "regexApplyTo": "text", "sort": "alphabeticalAsc", "definition": "label_values(up, instance)", "options": [ { "selected": false, "text": "All", "value": "$__all" }, { "selected": true, "text": "localhost:9090", "value": "localhost:9090" }, { "selected": false, "text": "localhost:9091", "value": "localhost:9091" } ], "multi": true, "includeAll": true, "allValue": ".*", "allowCustomValue": true } }, { "kind": "CustomVariable", "spec": { "name": "custom_var", "query": "prod,staging,dev", "current": { "text": "prod", "value": "prod" }, "options": [ { "selected": true, "text": "prod", "value": "prod" }, { "selected": false, "text": "staging", "value": "staging" }, { "selected": false, "text": "dev", "value": "dev" } ], "multi": false, "includeAll": true, "label": "Environment", "hide": "dontHide", "skipUrlSync": false, "description": "Deployment environment", "allowCustomValue": true } }, { "kind": "AdhocVariable", "group": "prometheus", "datasource": { "name": "existing-ref-uid" }, "spec": { "name": "adhoc_var", "baseFilters": [ { "key": "environment", "operator": "=", "value": "production" } ], "filters": [ { "key": "job", "operator": "=", "value": "prometheus" } ], "defaultKeys": [ { "text": "job", "value": "job" }, { "text": "instance", "value": "instance" } ], "label": "Filters", "hide": "dontHide", "skipUrlSync": false, "description": "Add filters", "allowCustomValue": true } }, { "kind": "ConstantVariable", "spec": { "name": "constant_var", "query": "my-application", "current": { "text": "my-application", "value": "my-application" }, "label": "App Name", "hide": "hideVariable", "skipUrlSync": true, "description": "Application name constant" } }, { "kind": "IntervalVariable", "spec": { "name": "interval_var", "query": "1m,5m,10m,30m,1h,6h,12h,1d,7d,14d,30d", "current": { "text": "5m", "value": "5m" }, "options": [ { "selected": false, "text": "1m", "value": "1m" }, { "selected": true, "text": "5m", "value": "5m" }, { "selected": false, "text": "10m", "value": "10m" } ], "auto": true, "auto_min": "10s", "auto_count": 30, "refresh": "onTimeRangeChanged", "label": "Interval", "hide": "dontHide", "skipUrlSync": false, "description": "Time interval for queries" } }, { "kind": "TextVariable", "spec": { "name": "textbox_var", "current": { "text": "error", "value": "error" }, "query": "default_search", "label": "Search Term", "hide": "dontHide", "skipUrlSync": false, "description": "Enter search term" } }, { "kind": "GroupByVariable", "group": "prometheus", "datasource": { "name": "existing-ref-uid" }, "spec": { "name": "groupby_var", "current": { "text": [ "job", "instance" ], "value": [ "job", "instance" ] }, "options": [ { "selected": true, "text": "job", "value": "job" }, { "selected": true, "text": "instance", "value": "instance" }, { "selected": false, "text": "region", "value": "region" } ], "multi": true, "label": "Group By", "hide": "dontHide", "skipUrlSync": false, "description": "Group results by field" } }, { "kind": "SwitchVariable", "spec": { "name": "switch_var", "current": "false", "enabledValue": "true", "disabledValue": "false", "label": "Enable Feature", "hide": "dontHide", "skipUrlSync": false, "description": "Toggle feature on/off" } }, { "kind": "QueryVariable", "spec": { "name": "legacy_string_var", "current": { "text": "legacy_value", "value": "legacy_string_content" }, "label": "Legacy Variable", "hide": "dontHide", "refresh": "onDashboardLoad", "skipUrlSync": false, "description": "Variable with legacy string value", "query": { "kind": "DataQuery", "group": "prometheus", "version": "v0", "datasource": { "name": "existing-ref-uid" }, "spec": { "__legacyStringValue": "up" } }, "regex": "", "sort": "disabled", "options": [], "multi": false, "includeAll": false, "allowCustomValue": true } }, { "kind": "QueryVariable", "spec": { "name": "complex_query_var", "current": { "text": [ "All", "host1", "host2" ], "value": [ "$__all", "host1", "host2" ] }, "label": "Complex Query Variable", "hide": "dontHide", "refresh": "onDashboardLoad", "skipUrlSync": false, "description": "Variable with complex query and all features", "query": { "kind": "DataQuery", "group": "elasticsearch", "version": "v0", "datasource": { "name": "existing-target-uid" }, "spec": { "bucketAggs": [ { "field": "@host", "id": "2", "type": "terms" } ], "query": "*", "size": 100 } }, "regex": "/host[0-9]+/", "regexApplyTo": "value", "sort": "alphabeticalDesc", "definition": "terms field:@host size:100", "options": [], "multi": true, "includeAll": true, "allValue": "*", "allowCustomValue": true } } ] }, "status": {} }