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

Analytics QS

wwitman edited this page Sep 28, 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 Services.

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? Where are errors occurring?

alt text

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.

Get an Apigee account

This feature requires an Apigee Edge account. You can sign up for Edge Free. An Edge Free account includes all of the features of Apigee Edge and can be used for up to 5 million API calls per quarter. While it does not include technical support, you are free to use the Apigee Edge Community forum to ask questions. For details about Edge Free and other pricing options, see Apigee Edge Pricing Features.

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 npm install.
  2. You must create or select an a127 account that includes the apigee provider. The command for creating an account is a127 account create <name>.
  3. Create a RemoteProxy service with a127 service create <name>. See Understanding remote services.
  4. Bind the service to your project with a127 project bind <service name>. The remote proxy is automatically deployed to Apigee Edge. It serves as a communication conduit for analytics data between Edge and your a127 API.
  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: 1000
       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: The maximum number of records to be stored in memory.

  • proxy: The name of the API proxy. This is the name that will show up in the Analytics dashboards.

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

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

Call the API

Run the application, by executing a127 project start. Test the program using curl. For example:

$ 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 Proxy performance under the Analytics menu, as explained next.

View the Proxy Performance dashboard

  1. Log in to the Apigee Edge management UI.
  2. Select Analyze > Proxy Performance to bring up the Proxy Performance dashboard.

alt text

This dashboard helps you see API proxy traffic patterns and processing times.

Try out some of the other dashboards:

alt text

For more information

For more info about Apigee Analytics and the Analytics dashboards, see these Apigee Edge doc topics:

Clone this wiki locally