AppDynamics template variables
Instead of hard-coding application names, tier names, or metric paths in your queries, you can use variables. Grafana displays these variables in drop-down select boxes at the top of the dashboard to help you change the data displayed in your dashboard. Grafana refers to such variables as template variables.
For an introduction to templates and variables, refer to the following topics:
Create AppDynamics query variables
To add a new AppDynamics query variable, refer to Add a query variable. Select your AppDynamics data source and use one of the supported query patterns.
The following table lists the supported query patterns for AppDynamics variables. Replace AppName and TierName with the actual application and tier names, or use previously defined variables such as ${application}.
Query variable examples
Chain variables for cascading drop-downs:
Create a set of dependent variables so that selecting an application automatically populates tier and business transaction options:
- Create a variable named
applicationwith the queryApplications. - Create a variable named
tierwith the query${application}.Tiers. - Create a variable named
btwith the query${application}.${tier}.BusinessTransactions.
Populate a variable from the metric hierarchy:
To create a variable that lists available metric names under a specific path:
- Query:
${application}.Path.Overall Application Performance
Populate a variable from an ADQL query:
To create a variable listing distinct transaction names:
- Query:
SELECT distinct(transactionName) FROM transactions
Only the first column of the result is used as the variable values.
Use variables in queries
After you create a variable, you can use it in your AppDynamics queries using variable syntax.
Metrics queries
Use ${variableName} in the Application field to dynamically select which application to query. For example, if you create a variable named application, select ${application} from the Application drop-down.
When a multi-value variable is used in the Application field and multiple values are selected, the plugin generates a separate query for each application and displays them as individual series.
Analytics queries
Use variables in ADQL queries with the appropriate
variable format. For example, use the doublequote formatter for string comparisons in WHERE clauses:
SELECT transactionName, avg(responseTime) FROM transactions WHERE transactionName IN (${transactionName:doublequote})API queries
Template variables are also supported in input fields for the Health, Events, Tiers, and Metric Names query types. For example, use ${application} in the application_id field of an Events query to dynamically filter events.
Limitations
The following limitations apply to template variables with the AppDynamics data source:
- Multi-value variables in metric paths are replaced with wildcards. When a multi-value variable is used in a metric path (not the Application field), all selected values are replaced with
*. To filter by multiple specific values, use an Analytics (ADQL) query with theINoperator instead.
For more information about variables, refer to Templates and variables.



