Grafana panels and rows have a 'Repeat options' setting that points at a template variable. Explain what determines how many copies appear, what the repeat direction and 'max per row' controls do, and what the practical limitations of repeats are.
answer
- one clone per SELECTED value, not per option
- needs multi-value or Include All
- inside a clone the variable is single-valued
- direction + max per row; grid is 24 units wide
- only the source panel is in the JSON — no per-clone edits
basics
~20 sA repeated panel or row is cloned once per currently selected value of the chosen variable, so the variable must be multi-value or have Include All. Direction controls horizontal versus vertical layout and max-per-row caps the horizontal run. Only the source panel exists in the dashboard JSON; clones are generated at render time and cannot be edited individually.
solid answer
~60 sRepeat binds a panel (or a row) to a variable: Grafana renders one clone per **selected** value, and inside each clone the variable resolves to that single value — so a query written as `service="$service"` behaves as a single-value query per copy. That is why repeats need multi-value or Include All: with one value selected you get one panel. **Direction** is horizontal or vertical; with horizontal, **max per row** caps how many clones sit side by side before wrapping (Grafana's grid is 24 units wide, so the clone width is derived from that cap). Row repeat clones the entire row and everything in it, which is the right tool for 'one section per environment'. Limitations worth stating: clones are ephemeral — the saved JSON holds only the source panel, so you cannot give clone #3 a different threshold or move it; a large selection produces a large number of concurrent queries and a heavy render; repeats re-evaluate whenever the variable changes; and per-clone links/titles need the variable in them (`$service`) or every copy looks identical.
go deeper
Say one copy per selected value, that the variable must be multi-value or have All, and that direction/max-per-row control layout.
Add that the variable is single-valued inside each clone, that only the source panel is persisted, and that row repeat clones the whole section.
Lead with cost — N clones means N queries and a heavy render — and give the repeat-versus-multi-series judgment plus guardrails on All.
Treat repeats as a capacity decision on both the browser and the data source; standardise caps, discourage row-repeat over unbounded variables, and note the provisioning benefit of one templated panel over generated ones.
## The model Repeat is Grafana's answer to 'I want the same panel per instance'. You mark a panel with `Repeat by variable: service`, and at render time Grafana produces one instance of the panel for each *currently selected* value of `service`. Within each instance the variable is bound to just that value, so any `$service` reference in the query, the title, the description, or a data link resolves to the one value that clone represents. Two consequences fall out immediately: 1. **The variable must be able to hold several values.** Turn on multi-value, or Include All, or both. A single-value variable produces exactly one copy, which is indistinguishable from not using repeat. 2. **The clone count is driven by the selection, not the option list.** Selecting three of twenty services gives three panels. Selecting All gives one per option — which is where dashboards fall over. ## Panel repeat versus row repeat **Panel repeat** clones one panel. Use it for 'a latency graph per service'. **Row repeat** clones a whole row and every panel inside it. Use it for 'a full section — traffic, errors, latency, saturation — per environment'. Panels inside a repeated row inherit the row's variable value, so their queries can reference `$env` and get the row's value. Row repeat is much more powerful and correspondingly easier to abuse: five rows of six panels against an All selection of twenty environments is 600 panels and 600+ queries. ## Layout controls Grafana's dashboard grid is 24 units wide. For a horizontal repeat, **max per row** sets how many clones share a row; the width of each clone is the grid width divided by that number, and the run wraps. Vertical repeat stacks clones down the page at the source panel's width. Choose horizontal for compact comparison (sparkline-ish panels), vertical when each copy needs full width to be readable. Repeats interact with the grid, so the source panel's position and size are the template for the clones; moving a clone is not possible because clones do not exist in the saved model. ## What you give up - **No per-clone customisation.** Only the source panel is persisted. You cannot set a different threshold, unit, or axis on the fifth copy, and you cannot reorder copies — ordering follows the variable's option/selection order (sort the variable if you care). - **No mixed repeats.** A panel repeats by exactly one variable. 'Per service × per region' is not a repeat; it is either a row repeat by one dimension containing panels repeating by the other, or a single panel with a multi-series query and a legend. - **Cost.** Every clone issues its own query. Repeat over All on a high-cardinality variable turns one dashboard load into hundreds of backend queries and a heavy browser render. Symptoms are a browser tab that pegs a CPU core and a data source that rate-limits or times out. Guard it: cap the variable's option list, avoid Include All on repeat-driving variables, or set a custom all value only when the panel query is written to accept a wildcard (in which case you probably want *one* panel with a multi-series result, not repeats). - **Re-evaluation.** Changing the variable rebuilds the repeat set. This is correct but visible: the layout reflows and in-flight queries are cancelled. ## Repeat versus a multi-series panel The honest alternative is often not to repeat at all. If the goal is comparison, one panel with a query returning one series per instance and a good legend is cheaper (one query, one render) and easier to read. Repeat wins when each instance needs its *own axes/thresholds/scale* — the classic case is per-service latency where one outlier would flatten a shared axis — or when each copy needs a distinct title and drill-down link. Say that trade-off out loud in an interview; it is the judgment the question is really probing. ## Provisioning note Because clones are not persisted, dashboards-as-code files stay small and readable under repeat: the JSON holds one panel with a `repeat` field. That is a genuine advantage over generating N panels at build time, and it means the dashboard adapts when the underlying instance set changes without a redeploy. ## Interview framing One sentence for the mechanism (one clone per selected value, variable bound per clone), one for the requirement (multi-value/All), one for layout (direction, max per row, 24-unit grid), then the limitations and the repeat-versus-multi-series judgment call.
- When is a repeated panel the wrong choice compared with one panel showing many series?When the instances are comparable on a shared axis. One panel with one series per instance is a single query and a single render, and it makes comparison easier. Repeats earn their cost when each instance needs its own axis, thresholds or scale — otherwise you are paying N queries for something a legend would have solved.
- Why can't you customise the third copy of a repeated panel?Clones are generated at render time from the single source panel; the dashboard's saved model contains only that source. There is nowhere to persist a per-clone override, and the clone set changes whenever the variable selection changes. If one instance genuinely needs different treatment, it has to be a separate, non-repeated panel.
saying these in an interview costs you the question
- Thinking repeat produces one panel per available option rather than per selected value.
- Enabling repeat on a single-value variable and reporting it as broken.
- Repeating a heavy row over an 'All' selection of a high-cardinality variable and blaming the data source for timeouts.
- Expecting to edit or drag an individual repeated copy.
- Trying to repeat one panel by two variables at once.