Skip to content
This repository was archived by the owner on Jul 14, 2022. It is now read-only.

Analytics QS

wwitman edited this page Mar 3, 2015 · 21 revisions

Adding Apigee Edge Analytics to your API

This topic explains how to add an analytics policy to your API. This policy connects your API to the powerful Apigee Edge Analytics service.

About Apigee Edge Analytics

Apigee Edge Analytics Services collects and analyzes a wealth of information that flows through APIs. This information is gathered, analyzed, and provided to you immediately, in real time. How is your API traffic trending over time? Who are your top developers? When is API response time fastest? Slowest? Are you attracting more developers? Geographically where do you see the most API traffic?

The answers to questions like these help you improve your APIs, attract the right app developers, troubleshoot problems, and, ultimately, make better business decisions related to your API program.

Adding the analytics policy to your API

  1. Be sure the volos-analytics-apigee module is listed in your project's package.json file. If not, add it and run a127 project edit.
  2. You must create or select an a127 account that include the apigee provider. The command for creating an account is a127 account create <name>.
  3. Create a RemoteProxy service. See Understanding remote services.
  4. Bind the service to your project with a127 project bind <service name>.
  5. Declare the analytics policy in the a127-services part of your project's api/swagger/swagger.yaml file. For example:
   analytics:
     provider: "volos-analytics-apigee"
     options:
       key: *apigeeProxyKey
       uri: *apigeeProxyUri
       proxy: WeatherExample,
       bufferSize: 100,
       flushInterval: 10,
       batchSize: 10
  1. Apply the analytics policy to each path you for which you want to collect analytics data. For example:
  /weather:
    x-swagger-router-controller: weather
    x-a127-apply:
      analytics: {}

Policy options

You can configure these options in the a127-services declaration:

  • bufferSize: Max number of records to be stored in memory.

  • proxy: Proxy to be associated with the in the analytics UI.

  • flushInterval: Intervals at which records are uploaded to Apigee, in miliseconds.

  • batchSize: Number of analytics records sent to Apigee in each batch.

Call the API

Start the a127 project and call the API. Call it several times in succession to simulate API traffic.

Bring up the analytics dashboards on Apigee Edge

  1. Log in to the Apigee Edge management UI.
  2. Select Analyze > Proxy Performance to bring up the Proxy Performance dashboard.
  • Run the application as before, by executing a127 project start. Test the program using curl:

    $ curl http://127.0.0.1:10010/weather\?city\=San%20Jose,CA

    Run the command at least ten times. Then you can verify that the analytics shows up on the Apigee UI by looking at API Proxy performance under the Analytics menu.

You can also add caching, quotas, OAuth, and deploy to Apigee.

Clone this wiki locally