API statistics are provided in both API Publisher and API Store Web applications. Apart from the number of subscriptions per API, all other statistical dashboards require that an instance of WSO2 Business Activity Monitor (version 2.3.0 or above) is installed. For instructions to set up BAM, see Publishing API Runtime Statistics. Once BAM is set up, follow the instructions below to view statistics through the API Publisher.
First, trigger some activities via the API gateway as explained in section Browser-Based REST Clients and wait a few seconds.
- The graphs you see on the API Manager statistical dashboards without setting up BAM are just samples and are not based on real runtime statistics of your server.
The sections below explain how to access the statistical dashboards:
API Publisher statistics
Log in to the API Publisher. If you have API creator and publisher privileges, the statistical menus that you see change as described below:
- If you have permission as
publisher
, the All Statistics menu will be visible in the left panel of the API Publisher.
- If you have permission to create APIs, in addition to the All Statistics menu, you also see the Statistics menu in the left panel of the API Publisher. The latter shows stats specific to the APIs created by you.
- Anyone who can create and/or publish APIs can view API-level usage and subscription statistics by clicking on a selected API and referring to its Versions and Users tabs.
Several examples of usage and performance statistics are given below:
If you want to see destination-based usage tracking, you must first enable it. See API Usage by Destination.
- Number of subscriptions per API (across all versions of an API)
- Number of API calls being made per API (across all versions of an API)
- The subscribers who did the last 10 API invocations and the APIs/versions they invoked
- Usage of an API and from which resource path (per API version)
- Number of times a user has accessed an API
- The number of API invocations that failed to reach the endpoint per API per user
In a faulty API invocation, the message is mediated though thefault
sequence. By default, the API Manager considers an API invocation to be faulty when the backend service is unavailable. - API Usage by Destination
An overview of the requests that leave the API Gateway to destination endpoints. It's particularly useful when the same API can reach different destinations such as load-balanced endpoints. This graph is not enabled by default. You must do it manually as follows:Enable usage tracking in the
<APIM_HOME>/repository/conf/api-manager.xml
file:<APIUsageTracking> <Enabled>true</Enabled> </APIUsageTracking>
- When creating the API, enable the graph from the Implement tab of the API Publisher UI:
API Store statistics
Log in to the API Store. You can self subscribe to the store. Next, click the Statistics menu.
Several examples of usage and performance statistics are given below:
- API usage per application
- Users who make the most API invocations, per application
- API usage from resource path, per application
- Number of faulty API invocations, per application
In a faulty API invocation, the message is mediated though thefault
sequence. By default, the API Manager considers an API invocation to be faulty when the backend service is unavailable.