Showing results for 
Show  only  | Search instead for 
Did you mean: 
AppDynamics Team (Retired)

Table of Contents


Many of our customers use the Controller Metrics and Events API to retrieve metric data information and information on various types of activities in a monitored environment, including Controller events. This article outlines a customer's use case and includes a generalized example script. 


Use Case


The customer is using the AppDynamics metrics API every minute to load the metric data from the Controller to an external system. The customer has multiple Controllers in the AppDynamics SaaS environment and hosts hundreds of applications. They load dozens of metrics from each application.


The customer is using the API for the following use cases:
  1. Use a third-party tool for troubleshooting in cases where they need 1-minute granularity for longer than 24 hours. For example, the customer often needs to perform root cause analysis but does not get to it until a few days after the incident occurred. 
  2. Use third-party tools to calculate percentiles, consolidate metrics across different controllers at the app or tier level as required and create alerts.
  3. Use a third-party tool to retain data for several years. Since their peak periods occur just once per year, customers might need data to be retained for 3 years to provide meaningful comparisons and plan their future deployments better.  



The customer uses a set of python scripts to retrieve the metrics. They consistently run into timeout errors and worry that the APIs are not scaling to their requirements.  


Our team engaged with the customer and offered to review their process and scripts. Upon review, we found that the python script opens 1000+ of concurrent connections to the Controller. There are only 10 threads dedicated to processing the REST requests on the server side.  As a result, the threads wait indefinitely and then timeout. 




  1. Use a thread pool to invoke the REST APIs.
    • This way the customer will have control on the concurrency. This should help to sustain 10 concurrent requests on the server side, getting the best performance.  
  2. Decrease the frequency of the job.
    • For example, run the job every 5 minutes rather than every one minute. 
    • We recommend restricting the number of Metric data points returned per REST call to less than 50K. 

Metric REST API Example

A RESTful API is an application program interface (API) that uses HTTP requests to GET data. The following section gives some examples of wildcards usage on Metric Data REST API. (This section scrolls horizontally.) The same example is included in the attached Metric REST API Example document for easy copy and paste.



URL: /controller/rest/applications/100/metric-data?metric-path=<metric-path>&time-range-type=BEFORE_NOW&duration-in-mins=1&rollup=true


URL Parameters: 

metric-path: Business%20Transaction%20Performance%7C%2A%7C%2A%7C%2A%7C%2A%7C%2A%7C%2A
time-range-type: BEFORE_NOW
duration-in-mins: 1

Success Response:

Response headers:
HTTP/1.1 200 OK
Server: AppDynamics
Content-Type: application/xml

Error Response:

REST endpoints can fail is many ways. From unauthorized access to wrongful parameters etc. Listed few error types:
HTTP/1.1 403 Forbidden
Server: AppDynamics
Content-Type: text/html
Incorrect Parameters:
Data type ("text"|"bin"|""): text
Response code: Non HTTP response code:
Response message: Non HTTP response message: Malformed esAPPDe

Sample Request Call:

GET https://hostname/controller/rest/applications/100/metric-data?metric-path=Business%20Transaction%20Performance%7C%2A%7C%2A%7C%2A%7C%2A%7C%2A%7C%2A&time-range-type=BEFORE_NOW&duration-in-mins=1&rollup=true
Cookie Data:
Request  Headers:
Accept-Encoding:gzip, deflate
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:30.0) Gecko/20100101 Firefox/30.0
Accept: application/json, text/plain, */*
Authorization: Basic Q2FwaXRhbE9uZS1Qcm9kJTQwQ2FwaXRhbE9uZS1Qcm9kOnRlc3QxMjM=

Sample Response Data: 

 <metricPath>Business Transaction
 Performance|Business Transactions|APPDInterface_PROD/APPDWebServices|BVLInterfaceWS2.Process|Individual
 Nodes|IP-200-254-23-APPDInterface_PROD/APPDWebServices|Average Block
 Block Time (ms)</metricName>

Metric Calls example of wildcards at various level: 

1.Six wild card (|*|*|*|*|*|*)  <metricPath>BusinessTransactionPerformance|BusinessTransactions|APPDInterface_PROD/APPDWebServices|BVLInterfaceWS2.Process|IndividualNodes|IP-200-254-23-APPDInterface_PROD/APPDWebServices| METRIC-NAME</metricPath>
2.Five wild card (|*|*|*|*|*)  <metricPath>BusinessTransactionPerformance|Business Transactions|APPDInterface_PROD/APPDWebServices|BVLInterfaceWS2.Process|IndividualNodes | METRIC-NAME</metricPath>
3.Four wild card (|*|*|*|*)  <metricPath>BusinessTransactionPerformance|Business Transactions|APPDInterface_PROD/APPDWebServices|BVLInterfaceWS2.Process|METRIC-NAME</metricPath>
4.Three wild card (|*|*|*)  <metricPath>Business TransactionPerformance|Business Transactions| APPDInterface_PROD/APPDWebServices|METRIC-NAME</metricPat>
5.Two wild card (|*|*)  <metricPath>BusinessTransactionPerformance|Business Transactions |METRIC-NAME</metricPath>
6.One wild card (|*)  <metricPath>BusinessTransactionPerformance|METRIC-NAME</metricPath>

Request  to keep metrics under 50K: 


If REST Call is fetching more than 50K metrics, you can replace wild characters with hard-coded values (e.g. TOMCAT-APP & Tranaction.SA), which will control metric count.




Find a test API script on Github here: Appdynamics/metric-loader


Version history
Last update:
‎05-04-2018 06:11 PM
Updated by: