Documentationbreadcrumb arrow Pluginsbreadcrumb arrow Sentrybreadcrumb arrow Template variables
Grafana Cloud Enterprise Open source
Last reviewed: April 7, 2026

Sentry template variables

Use template variables to create dynamic, reusable dashboards that let you switch between Sentry projects, environments, and teams without editing queries.

Before you begin

Supported variable types

The Sentry data source supports the following variable query types.

Variable query typeDisplay valueActual valueAdditional filters
ProjectsProject name and IDProject IDOptional team slug
EnvironmentsEnvironment nameEnvironment nameOptional project IDs
TeamsTeam name and slugTeam slugNone

Create a query variable

To create a query variable using the Sentry data source:

  1. Navigate to Dashboard settings > Variables.
  2. Click Add variable.
  3. Select Query as the variable type.
  4. Select the Sentry data source.
  5. In Query Type, select the type of Sentry entity you want to list: Projects, Environments, or Teams.
  6. Configure additional filters based on the selected query type:
    • Projects: Optionally select a Team slug to only list projects belonging to that team. The team selector shows all teams in your organization.
    • Environments: Optionally select one or more Project IDs to list environments for those projects. If no project is selected, environments from all projects are listed.
    • Teams: No additional configuration is needed.

Use variables in queries

After creating template variables, you can use them in query editor fields. The Projects and Environments drop-downs in the query editor automatically include your dashboard variables as selectable options, prefixed with var:.

For example, if you create a variable named project that lists Sentry projects, you can select var: ${project} in the Projects field of any Sentry query to dynamically filter by the selected project.

Variable examples

The following examples show common template variable configurations.

Filter dashboards by project

Create a variable that lets users select which Sentry project to display data for:

  1. Create a variable named project with Query Type set to Projects.
  2. Set Selection options to Multi-value if you want users to select multiple projects.
  3. In your dashboard queries, select var: ${project} in the Projects field.

Cascading project and environment variables

Create linked variables where the environment list depends on the selected project:

  1. Create a variable named project with Query Type set to Projects.
  2. Create a second variable named environment with Query Type set to Environments.
  3. In the environment variable configuration, select var: ${project} in the Project ID selector.
  4. When a user changes the project, the environment list updates automatically.

Filter projects by team

Create a variable scoped to a specific team’s projects:

  1. Create a variable named team with Query Type set to Teams.
  2. Create a second variable named project with Query Type set to Projects.
  3. In the project variable configuration, select var: ${team} in the Team slug selector.
  4. When a user selects a team, only that team’s projects appear in the project variable.

For more information about using variables in queries, refer to Variable syntax.