Dashboard schema
A dashboard is stored as a JSON document called the preset. When you manage dashboards with Terraform, the preset argument of the groundcover_dashboard resource is that document, passed as a JSON string. This page documents its schema so you can hand-write or review a preset instead of relying only on an export.
For how to build widgets in the UI, see Creating Dashboards. For what each visualization shows, see Dashboard Visualizations.
How the preset is validated
Unknown fields are rejected. The preset, widgets, queries, layout entries, time-series configuration (including
yAxis,rightYAxis,legend, and thresholds) are strict objects. A misspelled or invented field in them fails validation instead of being ignored.Only
schemaVersionis required at the top level. Every other top-level field falls back to an empty or default value when omitted.Layout is normalized for you. Overlapping layout entries are moved apart, negative
yvalues are shifted up, andminHis reset to the default for the widget type (see layout).
Top-level fields
schemaVersion (required)
Version of the preset format. Use 8 for new presets.
8
widgets
All widgets on the dashboard: charts, text notes, and sections. See widgets.
array of widget objects
duration
The default time range for the dashboard. Set it to the exact label of a predefined range in the time picker:
Last 1 minute, Last 5 minutes, Last 15 minutes, Last 30 minutes, Last hour, Last 1.5 hours, Last 3 hours, Last 6 hours, Last 12 hours, Last 1 day, Last 2 days, Last 7 days, Last 14 days, Last 30 days
The match is exact and case-sensitive. A value that is not one of these labels is not applied, and the dashboard opens on the time picker's own default instead. Omit the field (or use an empty string) to not set a default.
spec
layoutType
Layout mode of the dashboard grid. The UI default is ordered.
ordered, floating
crosshairSyncEnabled
When true, hovering one time-series chart shows the crosshair at the same time on the other time-series charts.
boolean
widgets
widgets is a flat list. Each entry has a type that decides which other fields apply. Every widget needs an id that is unique within the dashboard and matches an entry in layout.
Chart widget (type: "widget")
id (required)
Unique widget identifier, referenced by layout.
string
type (required)
Widget kind.
widget
name (required)
Title shown on the widget.
string
queries (required)
One or more queries that feed the widget. At least one is required. See queries.
array of query objects
description
Markdown description shown from the widget's info indicator. Keep it under 1,000 characters, which is what the UI displays.
string
Text widget (type: "text")
id (required)
Unique widget identifier.
string
type (required)
Widget kind.
text
content (required)
Markdown body of the note.
string
Section widget (type: "section")
A section groups widgets under a collapsible header. The widgets inside a section are listed in widgets like any other, and are attached to the section through children in layout.
id (required)
Unique widget identifier.
string
type (required)
Widget kind.
section
name (required)
Section header.
string
description
Markdown description of the section.
string
isCollapsed
When true, the section opens collapsed.
boolean
Section and text colors
none, gray, amber, lime, teal, sky, indigo, purple, pink, and the darker variants slate-dark, gray-dark, amber-dark, lime-dark, teal-dark, sky-dark, indigo-dark, purple-dark, pink-dark.
queries
Each entry in a chart widget's queries array describes one query. The compact shape below is what the UI exports.
id (required)
Identifier of the query within the widget. Formulas refer to other queries by this id, and table rules target a query by it. Examples: A, B.
string
expr (required)
The query text. MetricsQL for metrics; gcQL for the other data types; an arithmetic expression over other query ids for formulas (for example A / B).
string
step
Resolution of the query. Exported presets use disabled for queries that return a single value, such as stat, bar, and table widgets, and null or omit it to let groundcover choose.
string or null
editorMode
Whether the query was written in the query builder or the raw editor. Defaults to builder.
builder, editor
alias
Display name for the query's series.
string
selectedChartColor
Series color for this query.
DEFAULT, SEMANTIC, RED, GREEN, BLUE, ORANGE, GRAY, PURPLE
isHidden
When true, the query is hidden from the chart.
boolean
yAxisPosition
Which value axis a time-series query is plotted against. Defaults to the left axis. See rightYAxis.
left, right
selectedChartType
How this query is drawn in a time-series widget. Overrides the widget-level setting.
line, stackedBar, stackedArea
limit
Row limit of a formula query. Other queries carry their limit inside expr.
integer
dataType
metrics
Metrics, queried with MetricsQL
logs, traces, events
Logs, traces, and events, queried with gcQL
entities, issues, rum, apm, ingestion, aws_cur, dbm_measurements_statement
The other data sources available in the widget builder
metrics-formula, logs-formula, traces-formula, events-formula, entities-formula, issues-formula, rum-formula, apm-formula, ingestion-formula, aws_cur-formula, dbm_measurements_statement-formula
A formula over other queries of the widget. The value is the -formula counterpart of the data source the formula computes over
A formula is an ordinary query entry whose expr references other query ids. It has no data source of its own: it follows the queries it references, and its dataType records that source with a -formula suffix. A widget holds at most one formula. See Dashboard Visualizations for how formulas behave in the UI. For example, with queries A and B on metrics, this entry plots their ratio:
visualizationConfig
visualizationConfig.type selects the visualization and decides which other fields are allowed.
type
Visualization
time-series
Line, stacked bar, or stacked area chart over time
stat
Single value, optionally colored by rules
table
Tabular results
bar
Ranked bars (the Top list visualization in the UI)
pie
Pie chart
treemap
Treemap
data
Raw log, trace, or event rows
Fields shared by several types:
type (required)
all
Visualization type.
see above
step
all
Widget-level step.
string
selectedUnit
time-series, stat, table, bar, pie, treemap
Unit used to format values. See units.
unit name
customUnitLabel
time-series, stat, table, bar, pie, treemap
Free-text unit label shown next to values.
string
selectedChartColor
time-series, bar, pie
Palette used for the series.
DEFAULT, SEMANTIC, RED, GREEN, BLUE, ORANGE, GRAY, PURPLE
displayLabel
time-series, bar, pie, treemap
When grouping by several labels, show only this label's value as the series name.
string
For a treemap, selectedChartColor accepts only DEFAULT and SEMANTIC.
time-series
selectedChartType
Default mark for the widget's queries.
line, stackedBar, stackedArea
selectedChartColorOverride
Per-query palette override that survives widget-level color changes.
DEFAULT, SEMANTIC, RED, GREEN, BLUE, ORANGE, GRAY, PURPLE
rightYAxis
Optional right value axis for queries with yAxisPosition: "right". Takes the axis fields plus its own selectedUnit and customUnitLabel. The widget-level selectedUnit applies to the left axis only.
object
missingBuckets
How buckets without data are drawn.
nulls, zeros
thresholds
Reference lines or bands drawn on the chart. Up to 10. See thresholds.
array of threshold objects
Axis fields
zero
Force the axis to include zero.
boolean or null
min
Fixed lower bound.
number or null
max
Fixed upper bound.
number or null
scale
Axis scale.
linear, log
showLabel
Show the axis label.
boolean or null
legend
display
none hides the legend.
none, bottom
type
compact shows inline chips; table shows per-series statistics.
compact, table
columns
Statistic columns shown by the table legend.
array of avg, min, max, sum, value
thresholds
A threshold draws a reference on a time-series chart. Each entry is either a line at one value or a range band.
type (required)
Line at one value, or a band between two.
line, range
variant (required)
Semantic color.
error, warning, ok, info
style (required)
Stroke style.
dashed, solid
visible (required)
Whether the threshold is drawn.
boolean
showLabel (required)
Whether the label is drawn.
boolean
label
Label text.
string
id
Optional identifier.
string
value (required for line)
Where the line is drawn, in the axis unit.
number
min, max
Bounds of a range. Either may be omitted or null for a one-sided band.
number or null
stat
decimals
Fraction digits of the displayed value, or full for the unrounded value.
integer 0 to 4, or full
conditionalFormatting
Rules that color the value. See Conditional formatting.
array of rules, up to 10
table
columnOrder
Column names in display order.
array of strings
columnWidths
Column width by column name.
map<string,number>
pinnedColumns
Columns pinned to either side: { "left": [...], "right": [...] }.
object
sortModel
Default sort: { "field": "<column>", "sort": "asc" | "desc" }. Add query to sort on a specific query's value column.
object
unitOverrides
Per-column units: array of { "query": "<query id>", "field": "<value field>", "unit": "<unit>" }. field is optional.
array of objects
conditionalFormatting
Like stat rules, but each rule also names the query (and optionally the field) whose column it colors.
array of rules, up to 10
A table also accepts columnUnits, a map from column display name to unit, which is kept for presets saved before unitOverrides existed. Prefer unitOverrides in new presets.
data
sortModel
Default sort: { "field": "<column>", "sort": "asc" | "desc" }.
object
Conditional formatting
Rules color a stat value, or a table column, when the value matches a numeric condition. Rules are evaluated from top to bottom and the first match wins, so order them from most to least specific. A rule that overlaps one above it is ignored. At most 10 rules are allowed.
condition (required)
Comparison applied to the value.
greater-than, greater-than-or-equal, less-than, less-than-or-equal, equal-to, within-range
value (required)
The number to compare against. For within-range, the lower bound.
number
maxValue
Inclusive upper bound. Required when condition is within-range, and must be greater than or equal to value.
number
color (required)
Color applied on a match.
green-text, yellow-text, red-text, green-background, yellow-background, red-background
query (table only, required)
Id of the query whose column the rule applies to.
string
field (table only)
Value field within that query.
string
Units
selectedUnit accepts one of these values, written exactly as shown:
Data size
Bytes, KB, MB, GB, TB, PB, EB, ZB, YB, KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB
Data rate
Bytes/sec, Bits/sec, KB/s
Time
ps, ns, µs, ms, Seconds, min, h, d, mo, y
CPU
CPU, mCPU
Ratio
%, Percentage
Count and rate
Number, Raw, Req/s, Operations/sec
Currency
$
layout
layout places each widget on a grid that is 24 columns wide. Give every widget in widgets an entry.
id (required)
Id of the widget this entry positions.
string
x
Column of the left edge, counted from 0.
number
y
Row of the top edge.
number
w
Width in columns, out of 24.
number
h
Height in rows.
number
minH
Minimum height in rows. Reset to the default for the widget type: 8 for chart widgets, 4 for text widgets, 2 for sections.
number
minW
Minimum width in columns.
number
children
Layout entries of the widgets inside a section. Only meaningful on a section's entry.
array of layout objects (same fields, no nesting)
Children of a section are positioned relative to the section, and exported dashboards start them at y: 2, below the section header. Size the section's own h so that it contains its children. List a widget either at the top level of layout or as a child of a section, not both.
variables
Variables let one value, such as a cluster, filter many widgets. Each entry has a kind:
list(dynamic): the options are fetched from a data source.static_list: the options are a list you write.
See Variables for how they behave in the UI.
Dynamic variable (kind: "list")
kind (required)
Variable kind.
list
spec.variableName (required)
Name used to reference the variable in queries, without the $.
string
spec.datasource (required)
Where option values are fetched from.
object
spec.datasource.kind (required)
Data source. Use * to look the key up across all data sources.
metrics, logs, traces, events, entities, issues, rum, apm, ingestion, aws_cur, *
spec.datasource.key (required)
Label or attribute key whose values become the options.
string
spec.datasource.metric (required for metrics)
Metric that is queried for the key's values.
string
spec.values.default (required)
Values selected when the dashboard opens. Use ["*"] to select all.
array of strings
spec.overrides
Key overrides: when the variable is used against a given data source, it resolves to a different key. Each entry is { "datasource": "<kind>", "key": "<key>" }, where datasource is any kind except *.
array of objects
Static variable (kind: "static_list")
kind (required)
Variable kind.
static_list
spec.variableName (required)
Name used to reference the variable in queries, without the $.
string
spec.key (required)
The real label or attribute key the variable filters on. It can differ from the name, so a long key like k8s.namespace.name can be referenced as $ns.
string
spec.values.custom (required)
The options offered by the variable. The UI allows up to 100.
array of strings
spec.values.default (required)
Values selected when the dashboard opens.
array of strings
Referencing variables
In a MetricsQL query, reference a variable inside a label matcher with the regex operator, so that selecting several values, or all of them, works:
In a query-builder filter, the bare $name form expands to a whole filter atom, and $name.value expands to just the selected values. See Using a Variable.
Three system variables are always available, and are not declared in variables:
$interval
The chart step
$range
The time picker range
$range_s
The time picker range, in seconds
For example, sum(increase(groundcover_kube_pod_container_status_restarts_total{cluster=~"$cluster"}[$range])) counts restarts over whatever range the dashboard is showing.
Complete example
The resource below defines a dashboard with two dynamic variables, a note, a section that contains two widgets, a stat widget with conditional formatting, and a time-series widget with a threshold. It uses jsonencode so you can write the preset as native Terraform instead of an escaped string.
Last updated
