Nav

Lab 3: Monitor your API (Analytics)

Overview

Once we have made a deployment to the API Gateway it will start to push analytics data up to Anypoint Platform API analytics. This provides the ability to keep track of key metrics like top users, transactions by region, usage by tier and performance against SLAs in a set of interactive, graphical dashboards and charts. You can create Custom Dashboards in a few clicks and we provide the ability to extract metrics via an API for the API platform.

module 5 lab3 overview

Step 1: Viewing API Analytics

API analytics allow users to keep track of key metrics like top users, transactions by region, usage by tier and performance against SLAs in a set of interactive, graphical dashboards and charts.

You can see the API Analytics in API Manager

The API Settings page of each API provides some summaries of the analytics data such as number of requests, top apps and latency.

  1. As an Organization Administrator, you have access to the Analytics Dashboards for your organization. Go to API Manager and Click on Analytics to navigate to the overview dashboard.

    module 5 lab3 ap analytics dashboard

    When you access the Analytics for your organization, by default you land on your Overview Dashboard. This dashboard displays four standard charts:

    • Requests by Date: Line chart that shows the number of requests for all APIs in your organization.

    • Requests by Location: Map chart that shows the number of requests for each country of origin.

    • Requests by Application: Bar chart that shows the number of requests from each of the top five registered applications.

    • Requests by Platform: Ring chart that shows the number of requests broken down by platform.

  2. Interactive Dashboard: You can interact with the dashboards by clicking on the time range and dragging your mouse to create a custom time range. The overview dashboard graphs are linked together, so your custom time range could change the numbers and types of requests shown in the graphs at the bottom. For example, you can select a specific country, like Canada, to see only the requests from that specific location.

Step 2: Create a Custom Dashboard

The overview dashboard provides an aggregate view of the API usage, but there is typically a need to see more detailed API utilization. The Anypoint Analytics platform allows user to create charts and build custom dashboards for more detailed information. In this step we’ll create a custom dashboard by building 4 custom charts, including viewing response time, response codes, requests by city and policy violations.

module 5 lab3 ap analytics create custom

To create a custom dashboard:

  1. Click on the Custom Dashboard option in the menu on top

  2. Select Create Chart (note - click Edit Dashboard if you don’t see Create Chart on the left)

    module 5 lab3 ap analytics custom dashboad create chart
  3. Add a chart Title.

  4. Specify the metrics to chart the Response Time for your Mythical Omni Channel API Gateway and how to aggregate the values as shown below. Make sure to change the Data Interval to Minutes.

    module 5 lab3 ap analytics edit chart resp time
  5. When you’re complete select Save Chart.

  6. Create a chart to track Response Status Codes for all APIs as shown below.

    module 5 lab3 ap analytics edit chart request status
    Make sure to scroll down on the right side and pick the circular chart, not the default line graph. Otherwise you will not see the Group By option.
  7. Click Save Chart

  8. Create a chart with the grouping of requests by country and city.

    module 5 lab3 ap analytics edit chart reqs country
  9. Click Save Chart

  10. The last chart we will create is for measuring any requests that have policy violations.

    module 5 lab3 ap analytics edit chart policy violation
  11. Click Save Chart

    When your chart has been saved, it is available to be added to the canvas of your custom dashboard.

  12. Drag and drop your newly created charts to the dashboard canvas.

    module 5 lab3 ap analytics custom dashboard empty
    module 5 lab3 ap analytics custom dashboard complete
    If the drag-drop option doesn’t work on your browser, click on the green ‘+’ next to each chart on the left pane and it will get added to the canvas
  13. Click Save Dashboard in the top right of the Dashboard editor.

You will now have a dashboard that will display metrics that are custom to your API.

module 5 lab3 ap analytics custom dashboard finished

Summary

In this lab, you were able to monitor your APIs using the built in API Analytics and Custom Dashboards. This provides visibility in you APIs so you can understand how your APIs are being consumed and utilized.

module 5 lab3 overview

Additional details on creating custom dashboards and custom chart aggregations can be found in the Mule doc at Viewing API Analytics

Congratulations! You have completed Lab 3.

The next (optional) lab will show you how to govern a Mule application using autodiscovery.

Please proceed to Lab 4 if you wish.

If not…​

Congratulations! You have completed Module 5.

Please proceed to Module 6