This section explains how to set up WSO2 Data Analytics Server (WSO2 DAS) with the REST client, to collect, analyze, and publish runtime statistics from the API Manager, using the WSO2 APIM UI.
If you wish to configure Analytics using WSO2 DAS in WSO2 API Manager via XML, see Configuring Analytics in API Manager using XML.
From API Manager 1.10.x onwards, you can fetch summarized data using two clients:
- The REST client which fetches data directly from WSO2 DAS.
- The RDBMS client which fetches data from RDBMS.
From API Manager 1.10.x onwards, it is no longer possible to publish statistics via BAM. Instead, this is done using WSO2 DAS. In previous versions of API Manager, BAM put the summarized data on a separate RDBMS after which, API Manager fetches data from that RDBMS. With WSO2 DAS, data is shared more efficiently directly to API Manager using the DAS REST API. Therefore, there is no need to configure the RDBMS to generate statistics.
However, API Manager 1.10.x still supports RDBMS to generate summarized data. By default, summarised data is generated without configuring RDBMS. If you still want to use RDBMS, see Publishing API Runtime Statistics Using RDBMS.
Configuring WSO2 DAS
- Download WSO2 Data Analytics Server.
If API Manager and DAS run on the same machine, open the
<DAS_HOME>/repository/conf/carbon.xmlfile and increase the default service port of WSO2 DAS by setting the offset value as follows:
This increments all ports used by the server by 3, which means the WSO2 DAS server will run on port 9446. Port offset is used to increment the default port by a given value. It avoids possible port conflicts when multiple WSO2 products run on same host.
Configuring WSO2 API Manager
Download WSO2 API Manager.
- Start the API Manager server and log in to the Admin Dashboard (
- Click Configure Analytics under the Settings section.
- Select the Enable check box to enable statistical data publishing.
Set the event receiver configurations according to WSO2 DAS (e.g.
tcp://localhost:7614as the URL and
admin/adminas the username/password).Event receivers refer to the endpoint to which events are published from the API Gateway. WSO2 DAS consists of a thrift receiver, which acts as the default event receiver. By default, this receiver listens on port 7611 when no port offsets are set and increments according to the port offset set for WSO2 DAS in step 2 above.
- Click Add URL Group to save the configuration.
Set the configurations under the Data Analyzer Configurations section (e.g.
https://localhost:9446as the URL and
admin/adminas the username/password).This is the endpoint at which the data analyzer (WSO2 DAS, in this case) resides. The toolboxes specific to data analytics are deployed to this endpoint. By default, WSO2 DAS listens on port 9443 when no port offsets are set and increments according to the port offset set for WSO2 DAS in step 2 above.
Click Save. It deploys the Analytics toolbox, which describes the information collected, how to analyze the data, and the location of the database where the analyzed data is stored.
You can configure WSO2 API Manager to publish statistics to two WSO2 DAS instances that are not clustered following the steps below.
- Add a second receiver URL as shown in step 7 above.
- Deploy car files manually, in both instances
Invoking the sample
Invoke an API to generate traffic and see the statistics.
Log in to the API Publisher and deploy the sample CalculatorAPI.
Configuring API for Statistics of Usage by DestinationTo view the API Usage by Destination Statistics in API Publisher, you need to follow below steps and enable Usage Tracking for the API.
1. Edit the API you have created and go to the implementation Stage.
2. Open Show more Options under Endpoints and select Enabled for Destination-Based Usage Tracking.
Now you have configured the Calculator API to track the Destination Based Usage statistics.
- Log in to the API Store and subscribe to the API you created.
- Invoke the sample using the API Store or the cURL command and wait a few minutes for the analytics to be generated.
- In the API Publisher, click API Usage under the All Statistics section. For more information, see Viewing API Statistics.
Purging Data (optional)
Data purging is an option to remove historical data in WSO2 DAS. This is important since it is not possible to delete tables or table data in WSO2 DAS. By purging data, you can achieve high performance on data analysing without removing analysed summary data. Only data from the stream data fired by API Manager is purged and it is contained in the following tables:
There are two ways to purge data in DAS,
Using the admin console
- Navigate to the Data-explorer and select one of the above tables.
- Click Schedule Data Purge.
- On the dialog box that appears, set the time and days within which you want to purge data and save.
- Repeat the steps for all of the tables above and wait for the data to be purged.
Using the global method
- Open the
Change the contents under the
<analytics-data-purging>property as shown below:
- Save your changes.
- Restart the server for the changes to take effect.
You can purge all records by setting a minus value (e.g. -1) for