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 DESCSet the Limit field to control how many records are returned (default 100, maximum 1000). For aggregation queries like count(*) or avg(), the limit applies to the number of result rows, not the number of raw records scanned.
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 relevant to its API endpoint.
These query types support a Use dashboard’s time picker toggle. When enabled (default), the query automatically uses the dashboard’s time range. When disabled, you can specify a fixed time range directly in the query using the start-time and end-time fields.
For details on using the Events query type with annotations, refer to AppDynamics annotations.
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 the Roll-up toggle and a Stat panel to display the current value of a metric:
- 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 to return a single data point.
- Use a Stat or Gauge visualization to display the value.
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.
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.



