{ "apiVersion": "dashboard.grafana.app/v2alpha1", "kind": "Dashboard", "metadata": { "name": "test-v2alpha1-complete", "labels": { "category": "test" }, "annotations": { "description": "Complete example of v2alpha1 dashboard features" } }, "spec": { "title": "Test: Complete V2alpha1 Dashboard Example", "description": "This dashboard demonstrates all features that need to be converted from v2alpha1 to v2beta1", "editable": true, "liveNow": true, "preload": true, "cursorSync": "Tooltip", "tags": ["test", "example", "migration"], "annotations": [ { "kind": "AnnotationQuery", "spec": { "builtIn": true, "datasource": { "type": "grafana", "uid": "-- Grafana --" }, "enable": true, "hide": false, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", "query": { "kind": "grafana", "spec": { "limit": 100, "matchAny": false, "tags": [], "type": "dashboard" } } } }, { "kind": "AnnotationQuery", "spec": { "builtIn": false, "datasource": { "type": "prometheus", "uid": "gdev-prometheus" }, "enable": true, "hide": false, "iconColor": "yellow", "name": "Prometheus Annotations", "query": { "kind": "prometheus", "spec": { "expr": "changes(process_start_time_seconds[1m])", "refId": "Anno" } } } } ], "variables": [ { "kind": "QueryVariable", "spec": { "name": "prometheus_query", "datasource": { "type": "prometheus", "uid": "gdev-prometheus" }, "query": { "kind": "prometheus", "spec": { "expr": "up" } }, "refresh": "time", "regex": "", "sort": "alphabetical", "multi": true, "includeAll": true, "current": { "text": "All", "value": ["$__all"] }, "hide": "dontHide", "label": "Prometheus Query", "description": "Shows all up metrics", "skipUrlSync": false, "definition": "up" } }, { "kind": "TextVariable", "spec": { "name": "text_var", "label": "Text Variable", "description": "A simple text variable", "query": "server1,server2,server3", "current": { "selected": true, "text": "server1", "value": "server1" }, "hide": "dontHide", "skipUrlSync": false } }, { "kind": "ConstantVariable", "spec": { "name": "constant_var", "label": "Constant", "description": "A constant value", "query": "production", "current": { "selected": true, "text": "production", "value": "production" }, "hide": "dontHide", "skipUrlSync": true } }, { "kind": "DatasourceVariable", "spec": { "name": "ds_var", "label": "Datasource", "description": "Select a datasource", "pluginId": "prometheus", "refresh": "load", "regex": "/^gdev-/", "current": { "text": "gdev-prometheus", "value": "gdev-prometheus" }, "options": [ { "text": "gdev-prometheus", "value": "gdev-prometheus" } ], "multi": false, "includeAll": false, "hide": "dontHide", "skipUrlSync": false } }, { "kind": "IntervalVariable", "spec": { "name": "interval", "label": "Interval", "description": "Time interval selection", "query": "1m,5m,10m,30m,1h,6h,12h,1d", "current": { "selected": true, "text": "5m", "value": "5m" }, "options": [ { "text": "1m", "value": "1m" }, { "text": "5m", "value": "5m" }, { "text": "10m", "value": "10m" }, { "text": "30m", "value": "30m" }, { "text": "1h", "value": "1h" }, { "text": "6h", "value": "6h" }, { "text": "12h", "value": "12h" }, { "text": "1d", "value": "1d" } ], "auto": true, "auto_min": "10s", "auto_count": 30, "refresh": "load", "hide": "dontHide", "skipUrlSync": false } }, { "kind": "CustomVariable", "spec": { "name": "custom_var", "label": "Custom Options", "description": "Custom multi-value variable", "query": "prod : Production, staging : Staging, dev : Development", "current": { "text": ["Production"], "value": ["prod"] }, "options": [ { "text": "Production", "value": "prod" }, { "text": "Staging", "value": "staging" }, { "text": "Development", "value": "dev" } ], "multi": true, "includeAll": true, "allValue": "*", "hide": "dontHide", "skipUrlSync": false, "allowCustomValue": true } }, { "kind": "GroupByVariable", "spec": { "name": "group_by", "datasource": { "type": "prometheus", "uid": "gdev-prometheus" }, "current": { "text": "instance", "value": "instance" }, "description": "Group metrics by label", "hide": "dontHide", "label": "Group By" } }, { "kind": "AdhocVariable", "spec": { "name": "filters", "datasource": { "type": "prometheus", "uid": "gdev-prometheus" }, "baseFilters": [ { "key": "job", "operator": "=", "value": "grafana", "condition": "AND" } ], "filters": [], "hide": "dontHide", "label": "Filters", "defaultKeys": [ { "text": "job", "value": "job", "expandable": true }, { "text": "instance", "value": "instance", "expandable": true } ] } } ], "elements": { "panel-1": { "kind": "Panel", "spec": { "id": 1, "title": "Panel with Conditional Rendering", "description": "This panel demonstrates conditional rendering features", "data": { "kind": "QueryGroup", "spec": { "queries": [ { "kind": "PanelQuery", "spec": { "refId": "A", "datasource": { "uid": "gdev-prometheus" }, "query": { "kind": "prometheus", "spec": { "expr": "up{job=\"grafana\"}" } } } } ], "transformations": [ { "kind": "reduce", "spec": { "id": "reduce", "options": { "mode": "reduceFields", "includeTimeField": false, "reducers": ["mean"] } } } ] } }, "vizConfig": { "kind": "stat", "spec": { "pluginVersion": "12.1.0-pre", "options": { "colorMode": "value", "graphMode": "area", "justifyMode": "auto", "textMode": "auto" }, "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "thresholds": { "mode": "absolute", "steps": [ { "color": "red", "value": 0 }, { "color": "green", "value": 1 } ] }, "mappings": [ { "type": "value", "options": { "0": { "text": "Down", "color": "red" }, "1": { "text": "Up", "color": "green" } } } ] }, "overrides": [] } } } } } }, "layout": { "kind": "RowsLayout", "spec": { "rows": [ { "kind": "Row", "spec": { "title": "Conditional Row", "collapse": false, "hideHeader": false, "fillScreen": false, "conditionalRendering": { "kind": "ConditionalRenderingGroup", "spec": { "visibility": "show", "condition": "and", "items": [ { "kind": "ConditionalRenderingVariable", "spec": { "variable": "group_by", "operator": "includes", "value": "instance" } }, { "kind": "ConditionalRenderingData", "spec": { "value": true } }, { "kind": "ConditionalRenderingTimeRangeSize", "spec": { "value": "1h" } } ] } }, "layout": { "kind": "GridLayout", "spec": { "items": [ { "kind": "GridLayoutItem", "spec": { "x": 0, "y": 0, "width": 24, "height": 8, "element": { "kind": "ElementReference", "name": "panel-1" } } } ] } } } } ] } }, "timeSettings": { "timezone": "browser", "weekStart": "monday", "fiscalYearStartMonth": 0, "autoRefresh": "10s", "autoRefreshIntervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"], "from": "now-6h", "to": "now", "hideTimepicker": false } } }