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.
Create a query variable
To create a query variable using the Sentry data source:
- Navigate to Dashboard settings > Variables.
- Click Add variable.
- Select Query as the variable type.
- Select the Sentry data source.
- In Query Type, select the type of Sentry entity you want to list: Projects, Environments, or Teams.
- 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:
- Create a variable named
projectwith Query Type set to Projects. - Set Selection options to Multi-value if you want users to select multiple projects.
- 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:
- Create a variable named
projectwith Query Type set to Projects. - Create a second variable named
environmentwith Query Type set to Environments. - In the
environmentvariable configuration, selectvar: ${project}in the Project ID selector. - 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:
- Create a variable named
teamwith Query Type set to Teams. - Create a second variable named
projectwith Query Type set to Projects. - In the
projectvariable configuration, selectvar: ${team}in the Team slug selector. - 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.


