Chain variables together

Chained variables create dependent relationships where the options available in one variable depend on the selections made in another. This pattern enables cascading filters that help users drill down through hierarchical data structures.

Cascading filter patterns are common in multi-tier filtering scenarios such as region > cluster > namespace > pod. Each level narrows the available options based on the previous selection, creating an intuitive navigation experience through your infrastructure or data hierarchy.

To create chained variables, complete the following steps:

  1. Open your dashboard and click Edit.

  2. In the right sidebar, click Dashboard options (gear icon).

  3. Create your first-level (parent) variable if you don’t already have one.

    For example, in the Variables section click Add variable, choose Query, name it region, and enter query label_values(region). Click Save when finished.

  4. In the Variables section of the pane, click Add variable to create a dependent (child) variable.

  5. Click Query to choose the query variable type.

  6. Name your dependent variable.

    For example, enter cluster.

  7. Under Query options, click Open variable editor.

  8. Under Query type, select Classic query so the Query field appears.

    In the Query field, reference the parent variable to filter results.

    For example, use label_values(up{region="$region"}, cluster).

  9. Click Close to finish configuring the query.

  10. Click Save to save the dashboard with your chained variables.

  11. Test the cascading behavior by changing the parent variable selection. The dependent variable options should update automatically.

    Repeat to add additional levels—for example, a namespace variable that depends on cluster.

Selecting a value in the parent variable updates the available options in dependent variables, creating a cascading filter experience.

In the next milestone, you learn how to configure variable display options to control how variables appear to your users.


More to explore (optional)

At this point in your journey, you can explore the following paths:


page 6 of 9