AppDynamics Extension for AWS API Gateway Monitoring

Use Case

Captures statistics for APIs in the API Gateway from Amazon CloudWatch and displays them in the AppDynamics Metric Browser.

Prerequisites

  1. Before the extension is installed, the prerequisites mentioned here need to be met. Please do not proceed with the extension installation if the specified prerequisites are not met.
  2. The following permissions are needed to the AWS user whose accessKey and secretKey ae going to be used in the extension.
    cloudwatch:ListMetrics, cloudwatch:GetMetricStatistics
    The alternative to providing keys in the extension is installing the machine agent with the extension on an AWS EC2 instance and providing the instance with a role that has the above permissions.

Installing the extension

  1. Download and unzip the AWSAPIGatewayMonitor-version.zip file into <MACHINE_AGENT_HOME>/monitors/ directory.
  2. Configure the extension by referring to the below section.
  3. Restart the machine agent.

Configuring the extension using config.yml

Configure the AWS API Gateway monitoring extension by editing the config.yml file in <MACHINE_AGENT_HOME>/monitors/AWSAPIGatewayMonitor/

  1. Edit the file config.yml located at <MachineAgent_Dir>/monitors/AWSAPIGatewayMonito The metricPrefix of the extension has to be configured as specified here. Please make sure that the right metricPrefix is chosen based on your machine agent deployment, otherwise this could lead to metrics not being visible in the controller.
  2. Configure the cloud watch monitoring level. This is required to reduce the number of API calls to cloudwatch. Basic will fire CloudWatch API calls every 5 minutes. Detailed will fire CloudWatch API calls every 1 minutes
    cloudWatchMonitoring: "Basic"
    
    If you want to run the extension with a further delay, comment the "cloudWatchMonitoring" and use the following field which takes in the number of minutes after which the extension should call the cloudwatch metrics.
    cloudWatchMonitoringInterval:10
    
  3. Configure the AWS account by specifying the awsAccessKey, awsSecretKey of the AWS account. displayAccountName(required) and regions(required) also needs to be configured.

    For example,

    accounts:
      - awsAccessKey: "XXXXXXXX1"
        awsSecretKey: "XXXXXXXXXX1"
        displayAccountName: "TestAccount_1"
        regions: ["us-east-1","us-west-1","us-west-2"]
    

    NOTE: If you have the machine agent with extension installed on an AWS EC2 instance which has an assigned role with appropriate permissions as specified in the prerequisites section, then the awsAccessKey and awsSecretKey fields should be left empty as follows:

    accounts:
      - awsAccessKey: ""
        awsSecretKey: ""
        displayAccountName: "TestAccount_1"
        regions: ["us-east-1","us-west-1","us-west-2"]
    

  4. If you know for which Apis you need the metrics for, the you can monitor only those Apis. This can be done by secifying the patterns of the Api names that needs to be minitored

    For example, If you want only Apis who name is exactly "sample" as well as the Apis with the name starting with demo, then you can configure it as below

    apiNames: ["^sample$", "^demo"]
    

Metrics

The following metrics are available at each API level:
  • 4XXError : The number of client-side errors captured in a specified period.
  • 5XXError : The number of server-side errors captured in a given period.
  • CacheHitCount : The number of requests served from the API cache in a given period.
  • CacheMissCount : The number of requests served from the back end in a given period, when API caching is enabled.
  • Count : The total number API requests in a given period.
  • IntegrationLatency : The time between when API Gateway relays a request to the back end and when it receives a response from the back end.
  • Latency : The time between when API Gateway receives a request from a client and when it returns a response to the client. The latency includes the integration latency and other API Gateway overhead.

Apart from the above metrics, the extension also gives a metric called "API calls" at the extension level, that gives out the number of cloudwatch API calls per minutes from the extension.

Advanced Configuration

Prerequisites:
You need to have events service setup and working before you do the following.
Configuration steps:

To get configuration metrics related to AWS API Gateway on your analytics platform, please follow the below steps:

  • 1. In the config.yml, uncomment the following section and enable the different metrics you want.
    #eventsService:
    #    enableTraditionalMetrics: false
    #    enableApiMetrics: false
    #    enableResourceMetrics: false
    #    enableStageMetrics: false
    #    credentials:
    #        controllerEventsServiceHost: ""
    #        controllerEventsServicePort: 9080
    #        enableSSL: false
    #        controllerGlobalAccountName: ""
    #        eventsAPIKey: ""
    
  • 2. For example, if you want to enable the resource metrics, change the enableResourceMetrics field to true. Do the same for enableTraditionalMetrics, enableApiMetrics, enableResourceMetrics, enableStageMetrics as per you requirement.
     enableTraditionalMetrics: false
     enableApiMetrics: false
     enableResourceMetrics: false
     enableStageMetrics: false
    
  • 3. Fill out the credentials section with the events service host credentials. "controllerEventsServiceHost" is the host that contains the events service. "controllerEventsServicePort" is the port of the events service. "controllerGlobalAccountName" is the Global Account Name that can be found from License -> Account in the controller. You need to create an eventsAPIKey for the extension. This can be done from the analytics section on the controller.
    credentials:
            controllerEventsServiceHost: ""
            controllerEventsServicePort: 9080
            enableSSL: false
            controllerGlobalAccountName: ""
            eventsAPIKey: ""
    
  • 4. Once all the details are filled and the extension is restarted, you can see the configuration metrics in the analytics section of the controller. The tables that contain the data are:
    AWSAPIGatewayMonitor_traditionalMetrics
    AWSAPIGatewayMonitor_APIMetrics
    AWSAPIGatewayMonitor_ResourceMetrics
    AWSAPIGatewayMonitor_StageMetrics
    

WorkBench

Workbench is an inbuilt feature provided with each extension in order to assist you to fine tune the extension setup before you actually deploy it on the controller. Please review the following document on How to use the Extensions WorkBench

Troubleshooting

Please follow the steps specified in the Troubleshooting document to debug problems faced while using the extension.

Contributing

Always feel free to fork and contribute any changes directly via GitHub.

Compatibility

Current Version:

2.0.0

Controller compatibility:

4.4 or later

Last Update:

06/01/2018