AppDynamics query editor
The AppDynamics query editor allows you to build queries for AppDynamics data in dashboards, Explore, and alerting. The query editor supports the following query types:
- Metrics - Query application performance metrics from the AppDynamics Metrics API.
- Analytics - Query analytics data using ADQL (AppDynamics Query Language) from the Analytics Events API.
- Health - Query health rule violations for an application.
- Events - Query application events such as deployments, errors, and policy violations.
- Tiers - Query tier information for an application.
- Metric Names - Browse the metric hierarchy for an application.
Select a query type using the radio buttons at the top of the query editor. For general information on Grafana query editors, refer to Query editors.
Key concepts
If you’re new to AppDynamics, here are key terms used in this documentation:
Metrics query type
To create a Metrics query, select Metrics from the query type radio buttons. The Metrics query editor queries application performance metrics from the AppDynamics Controller REST API.
Raw edit mode
By default, the metric field uses segment-based selection where you navigate through the metric hierarchy one level at a time. Click the edit icon (pencil) next to the Metric field to switch to raw text input mode, which allows you to type or paste a full metric path directly. Click the checkmark icon to apply changes when using raw edit mode.
Configure labels
Customize how series are labeled in your visualizations using the Labels drop-down below the main query fields.
Full Path - Uses the full metric path as the label. For example:
Overall Application Performance|Average Response Time (ms).Segments - Builds the label from specific segments of the metric path. Segment indexing starts at 1. For example, with a metric path of
Errors|mywebsite|Error|Errors per Minuteand segments2, 4, the label showsmywebsite|Errors per Minute.Custom - Combines free text with aliasing patterns to include metric metadata:
{{app}}- The application name.{{n}}- The nth segment from the metric path.
For example, with the metric path
Overall Application Performance|Average Response Time (ms)and the custom label{{app}} MetricPart2: {{2}}, the result ismyApp MetricPart2: Average Response Time (ms).
Note
If your query is for a Stat panel or another visualization where the label isn’t visible, click Show Metadata below the query to view the label. This button appears after running a query that returns data.
Analytics query type
To create an Analytics query, select Analytics from the query type radio buttons. Analytics queries use ADQL to query AppDynamics analytics data.
Note
Analytics queries require separate authentication. Ensure you’ve configured the Analytics API URL, API key, and Global Account Name in the data source configuration.
The query editor provides a code editor with autocomplete suggestions for fields, tables, and template variables as you type your ADQL query.
Analytics query examples
The following examples demonstrate common ADQL query patterns.
Count transactions grouped by name, filtered by a template variable:
SELECT distinct(transactionName), count(*) FROM transactions WHERE transactionName IN (${transactionName:doublequote})Aggregate response times into a time series by user experience:
SELECT series(eventTimestamp, '1m'), userExperience, count(*) FROM transactionsQuery the slowest transactions over the selected time range:
SELECT transactionName, max(responseTime) AS maxResponseTime FROM transactions ORDER BY maxResponseTime DESC LIMIT 10Query application logs for errors:
SELECT eventTimestamp, MSGTY, MSGTXT, Application FROM application_logs WHERE MSGTY = 'E'Query browser performance records:
SELECT pageUrl, avg(domReadyTime) AS avgDomReady, count(*) AS total FROM browser_records ORDER BY avgDomReady DESCFilter to the dashboard or alert time range:
SELECT series(eventTimestamp, '1m'), count(*) FROM transactions WHERE eventTimestamp >= $__from AND eventTimestamp <= $__toSet the Limit field to control how many records are returned (default 100). The query editor suggests a maximum of 1000; the backend doesn’t enforce that cap. For aggregation queries like count(*) or avg(), the limit applies to the number of result rows, not the number of raw records scanned.
Time macros
The plugin interpolates the following time macros in Analytics queries to epoch milliseconds from the dashboard or alert time range. Use them in ADQL filters so queries work in dashboards and in alerting:
Example:
SELECT count(*) FROM transactions WHERE eventTimestamp >= $__from AND eventTimestamp <= $__toTo use these macros in alert rules, refer to AppDynamics alerting.
Health, Events, Tiers, and Metric Names query types
The Health, Events, Tiers, and Metric Names query types use form-based editors to query the AppDynamics Controller REST API. Each type provides specific input fields for its API endpoint.
The Health, Events, and Tiers query types include a Use dashboard’s time picker toggle. When enabled (the default for new queries), the query uses the dashboard time range and hides start-time and end-time. When disabled, set a fixed range with time-range-type, start-time, end-time, and duration-in-mins as needed. Metric Names queries don’t include this toggle.
In alerting, the toggle is hidden and the alert evaluation window is used as the time range.
Time-range-type values are BETWEEN_TIMES (default), BEFORE_NOW, BEFORE_TIME, and AFTER_TIME:
BETWEEN_TIMESuses the dashboard or alert time range.BEFORE_NOWrequires duration-in-mins.BEFORE_TIMErequires duration-in-mins and end-time.AFTER_TIMErequires duration-in-mins and start-time.
Times are in milliseconds since epoch.
Health
Health queries retrieve health rule violations for an application. Use a table visualization.
To list open and recent health rule violations:
- Select Health from the query type radio buttons.
- Select your application from application_id.
- Leave Use dashboard’s time picker enabled.
- Use a Table visualization.
Events
Events queries retrieve application events such as deployments, errors, and policy violations. Use a table panel, or overlay the same query as annotations. For annotation setup and a list of common event types, refer to AppDynamics annotations.
eventtype and event-types are different fields. Use event-types to choose which events AppDynamics returns. Leave eventtype at the editor default unless you have a reason to change it. The editor marks summary and comment required.
To list deployment events in a table:
- Select Events from the query type radio buttons.
- Select your application from application_id, or type
${application}. - Fill summary and comment.
- Leave eventtype at the default.
- Select
APPLICATION_DEPLOYMENTfrom event-types. - Select
INFOfrom severities. - Leave Use dashboard’s time picker enabled.
The application_id drop-down lists applications, not dashboard variables. Type ${application} as a custom value rather than selecting a numeric application ID.
Tiers
Tiers queries list tiers in an application. When you set a time range, SaaS Controllers can limit results to tiers that were alive in that window. On-premises Controllers return all tiers.
To list tiers:
- Select Tiers from the query type radio buttons.
- Select your application from application_id.
- Leave Use dashboard’s time picker enabled.
- Use a Table visualization.
Metric Names
Metric Names queries browse the metric hierarchy. They don’t return time-series values. Use this type to discover valid metric paths for Metrics queries or template variables.
To list metrics under overall application performance:
- Select Metric Names from the query type radio buttons.
- Select your application from application_id.
- Set metric-path to
Overall Application Performance. - Use a Table visualization.
Use cases
The following examples demonstrate common use cases for the AppDynamics data source.
Monitor application response time
Query the average response time for an application to track performance trends:
- Select Metrics from the query type radio buttons.
- Select your application from the Application drop-down.
- Navigate to
Overall Application Performance|Average Response Time (ms)in the Metric selector. - Set Labels to Custom and enter
{{app}} - Response Time.
Display a single metric value
Use Roll-up and a Stat panel to display a rolled-up value for the time range:
- Select Metrics from the query type radio buttons.
- Select your application from the Application drop-down.
- Navigate to
Overall Application Performance|Calls per Minutein the Metric selector. - Set Aggregation to Sum.
- Toggle Roll-up on.
- Use a Stat or Gauge visualization.
Monitor a business transaction
Query calls per minute for a business transaction. Use * in a path segment to match all transactions:
- Select Metrics from the query type radio buttons.
- Select your application from the Application drop-down.
- In raw edit mode, enter
Business Transaction Performance|Business Transactions|*|Calls per Minute. - Set Labels to Segments and enter
3so the series name is the business transaction.
Track error rates
Query error metrics to monitor application health:
- Select Metrics from the query type radio buttons.
- Select your application from the Application drop-down.
- Navigate to
Overall Application Performance|Errors per Minutein the Metric selector. - Set Aggregation to Max to see peak error rates.
Compare metrics across applications
Use a template variable for the application to compare the same metric across multiple applications:
- Create a template variable with the query
Applications. - Select Metrics from the query type radio buttons.
- Select
${application}from the Application drop-down. - Navigate to the desired metric path.
When multiple applications are selected, the plugin generates a separate query for each application and displays them as individual series.
List health rule violations
Use the Health query type to show violations in a table:
- Select Health from the query type radio buttons.
- Select your application from application_id.
- Leave Use dashboard’s time picker enabled.
- Use a Table visualization.
Analyze business transactions
Use an Analytics query to analyze business transaction volume and performance:
SELECT transactionName, count(*) AS total, avg(responseTime) AS avgResponseTime FROM transactions ORDER BY total DESCIdentify slow transactions
Find transactions that exceed a response time threshold:
SELECT transactionName, responseTime, eventTimestamp FROM transactions WHERE responseTime > 5000 ORDER BY responseTime DESCSet Limit to 50 to retrieve the top 50 slowest transactions.
Monitor user experience distribution
Visualize how user experience is distributed across transactions:
SELECT series(eventTimestamp, '5m'), userExperience, count(*) FROM transactionsThis query returns a time series grouped by user experience category (NORMAL, SLOW, VERY_SLOW, STALL, ERROR), suitable for a stacked bar or time series visualization.


