Grafana Cloud Enterprise Open source
Last reviewed: July 8, 2026

Pyroscope template variables

Template variables let you create dynamic, reusable dashboards by replacing hard-coded values, such as service names or profile types, with selectable variables. Grafana displays these variables as drop-down menus at the top of the dashboard, letting viewers change the displayed data without editing queries.

For an introduction to templating and template variables, refer to Templating and Add and manage variables.

Query variable types

Query variables query the Pyroscope data source to populate drop-down values. When you create a query variable, select a Pyroscope data source and choose a query type.

Query typeRequired inputsDescription
Profile typeNoneReturns the profile types available from the data source. The drop-down displays a readable label, while the variable value is the full profile type ID, such as process_cpu:cpu:nanoseconds:cpu:nanoseconds.
LabelProfile typeReturns the label names available for the selected profile type, such as service_name, namespace, and region.
Label valueProfile type, labelReturns the values for the selected label, scoped to the selected profile type.

Because the Label and Label value query types require a profile type, and Label value also requires a label, you can chain these variables so that each one depends on the previous selection.

Create a query variable

To create a query variable:

  1. Navigate to Dashboard settings > Variables.
  2. Select Add variable.
  3. Set Select variable type to Query.
  4. Select the Pyroscope data source.
  5. Select a Query type of Profile type, Label, or Label value.
  6. For a Label or Label value query, select a Profile type.
  7. For a Label value query, select a Label.
  8. Select Apply to save the variable.

Query variable examples

The following examples show common ways to use Pyroscope query variables.

Select a profile type from a drop-down:

Create a variable named profile_type to let viewers switch the profile type without editing the query:

  1. Set Query type to Profile type.
  2. Save the variable. The drop-down displays readable labels, while each value is the full profile type ID, such as process_cpu:cpu:nanoseconds:cpu:nanoseconds.

You can then reference $profile_type in the query editor’s profile type field.

Populate a drop-down with services:

Create a variable named service that lists the services sending profiles:

  1. Set Query type to Label value.
  2. Set Profile type to a profile type, such as process_cpu:cpu:nanoseconds:cpu:nanoseconds.
  3. Set Label to service_name.
  4. Save the variable. The drop-down now lists the values of the service_name label.

Chain dependent variables:

Combine variables so each one narrows the next. This example builds a profile type selector, a label selector, and a label value selector that all update together:

  1. Create a profile_type variable with Query type set to Profile type.