AWS Application Signals template variables
Template variables turn a static X-Ray dashboard into an on-call superpower: one dashboard, many services, many accounts, many regions — all driven by drop-downs at the top of the page. Use them to let viewers swap the AWS region, pivot to a linked account, zoom in on a specific service and operation, or combine those selections in filter expressions without rewriting a single query.
This document lists every variable type the data source supports, shows the exact fields each one exposes, and walks through cascading-variable setups, multi-value filters, and the subtle formatting rules you need to keep filter expressions valid.
Before you begin
Supported variable types
The AWS Application Signals data source supports the following Grafana variable types:
Query variable types
When you create a query variable, the data source exposes the following query types. Each type has its own required fields.
Note
The Accounts query type only returns values when cross-account observability is configured on your AWS account and the data source’s IAM identity has the
oam:ListSinksandoam:ListAttachedLinkspermissions. Refer to Cross-account observability.
The Service variable’s value is a JSON blob
The Service query type returns each option as an object with two parts:
- A display
textset to the service’sName(for example,checkout-api). - A
valueset to the full service descriptor serialized as JSON (for example,{"Type":"Service","Name":"checkout-api","Environment":"eks:prod/default"}).
The JSON value is what the List service operations, List service dependencies, and List SLOs APIs require, so the variable works out of the box when you reference it in those Services-mode drop-downs. However, the JSON form breaks X-Ray filter expressions. When you use the Service variable in a Trace list or Trace statistics filter expression, always append the :text format to get the display name:
service("${service:text}")Referencing it as $service inserts the raw JSON blob and produces an invalid filter expression.
Create a query variable
To create a query variable:
- Open the dashboard and click Settings (the gear icon).
- Select Variables > Add variable.
- Set Select variable type to Query.
- In Data source, select your AWS Application Signals data source.
- Select a Query type (for example, Services).
- Fill in the required fields. Every non-Regions query type requires a Region, either typed in or provided by another variable.
- Optionally set Refresh to On dashboard load or On time range change. For cascading variables that depend on the time range, use On time range change.
- Click Apply.
Cascading variable setup
Define variables in dependency order so each drop-down filters the next. The following sequence is the recommended cascade for the AWS Application Signals data source:
Set Refresh to On time range change on accountId, service, and operation so they re-fetch when users adjust the dashboard time range.
If you don’t use cross-account observability, skip the group and accountId variables — leave AccountId blank on the service variable to query the data source’s own account.
Use variables in queries
The data source interpolates template variables in the following query editor fields:
- Trace list and Trace statistics Query (filter expressions)
- Region drop-down
- AccountId and AccountIds drop-downs
- Services mode Service drop-down
- Services mode Operation drop-down
Reference variables with the standard Grafana syntax:
$region
${service}
[[accountId]]Format modifiers you’re likely to need
Grafana supports variable format modifiers that control how a variable’s value is rendered at query time. The following are the most relevant modifiers for this data source:
Example — filter by selected service (correct form)
Because the Service variable’s value is JSON (see The Service variable’s value is a JSON blob), use :text to filter a Trace list or Trace statistics query by service name:
service("${service:text}")Example — filter by service and a single account
Combine the service and accountId variables in a filter expression. accountId is a plain string, so no format modifier is needed:
service("${service:text}") AND service(id(account.id: "$accountId"))Example — multi-value AccountIds in Service Map
The Service Map query type exposes a first-class AccountId multi-select, which is the easiest way to work with multiple accounts. Define an AccountIds variable with Multi-value enabled (for example, populated from the Accounts query type), then select it from the Service Map AccountId drop-down. The plugin sends every selected value to the API without requiring any format modifier on your end.
For Trace list and Trace statistics queries, X-Ray filter expressions don’t have a documented list operator for account.id, so driving them from a multi-value variable isn’t reliable. Use one of these approaches instead:
- Set the dashboard account selector to a single value and use
service("${service:text}") AND service(id(account.id: "$accountId"))in the filter expression. - Switch to a Service Map query and use its built-in AccountId multi-select.
Example — drive Services-mode drop-downs with variables
In Services mode, template variables can populate the plugin’s own drop-downs. Select a template variable from the Service or Operation drop-down instead of a literal value:
- Region:
$region - AccountId:
$accountId(use the literalallvalue from the Accounts query type’s synthetic All entry to query every linked account) - Service:
$service— the JSON value is exactly what the underlying APIs expect, so no format modifier is required in these drop-downs. - Operation:
$operation
Example — alert on a per-service fault rate
Cascading variables are especially useful for alert rules. Create a Trace statistics panel with the query below and build an alert on it to get one rule per service without hand-maintaining a rule per team:
service("${service:text}") AND fault = truePair this with the accountId variable when you run alerts across linked accounts. Refer to Alerting with the AWS Application Signals data source for end-to-end guidance.


