Discover our knowledge. Read our blogs!

Learn more

We build all our solutions with WSO2 and we are proud that we are Platinum Value-Added Reseller of WSO.

Learn more

What's the added value of API Analytics report generation?

5 min read

What's the added value of API Analytics report generation?PDF reporting is useful for an organization if API data analytics reports need to be sent to various stakeholders.

The added value of the reports are:

  • It keeps track of API usage and consequently assesses revenue generated by API, if monetized;
  • It gives an idea of which application and user uses an API more compared to others. Hence, helps in driving business decisions;
  • It helps manage the availability and performance of a given API based on the usage of the report;
  • It provides information about what period of time the API usage is unusually high and hence manages user expectations.

WSO2 API Manager Analytics

The WSO2 API Manager (APIM) integrates with WSO2 APIM Analytics to provide reports, statistics and graphs on the APIs deployed in WSO2 APIM.

The APIM Analytics consists of two components:

  1. Worker: It is responsible to process the data streams sent from WSO2 APIM and publishes the statistics to a database;
  2. Dashboard: The dashboard reads the statistics published by the worker and displays the statistics on the dashboard.

The worker and dashboard are connected via the database.

How to configure WSO2 API Manager Analytics:

Before generating analytics data (in this case, the monthly API Usage report ) from an API usage, we need to set up APIM Analytics (powered by WSO2 Streaming Integrator). The steps to set up the WSO2 APIM with Analytics can be found on the WSO2 website.

Once the set up and configuration are done, we need to create two sample APIs so that we can show the usage in the generated report:

  1. Pizzashack API: This can be directly deployed in APIM as it is available for deployment in publisher with a button click;
  2. PetStore API: This can be created as described here.

Subscribe and test both APIs from ‘Try out’ option available in Dev Portal of the WSO2 API Manager. Run various resources multiple times to get a better view in the report.

After that, you can login into the Analytics dashboard and select APIM Admin as shown below.

yenlo_blog_2020-07-api-analytics-report-generation_figure-1

Important to notice here that the permission to access the APIM Admin component of the analytics dashboard is only available for users with admin roles.

The following UI widget generates a PDF report of a specific year and month combination. The report can be downloaded by clicking on the download button.

yenlo_blog_2020-07-api-analytics-report-generation_figure-2

The PDF report contains a table with the following information:

  1. API name;
  2. API version;
  3. Application name;
  4. Application owner;
  5. Request Count.

We can see the sample PDF, as shown below, for the two sample APIs as described above.

yenlo_blog_2020-07-api-analytics-report-generation_figure-3

Customizing the Report:

The default implementation can be overidden and extended if it requires different data than the ones provided by the default report.

This can be achieved by implementing the ReportGenerator interface.

The default implementation can be used as a reference when implementing the extended version. Check out this sample custom implementation of the WSO2 APIM Analytics Monthly Usage report.

Once the implementation is done, the bundle needs to be placed in {ANALYTICS_HOME/lib} directory and the report:implClass config of the dashboard deployment.yaml should be changed to the fully qualified class name of the custom implementation as follows.

  report:

   implClass: org.wso2.analytics.apim.custompdf.CustomPDFGenerator

Conclusion

PDF reporting using WSO2 API Manager Analytics can be quite useful for the stakeholders for the reasons mentioned in the opening paragraph of this blog. This release of WSO2 API Manager Analytics 3.1.0 includes the first cut of the implementation of this feature. The default implementation of this feature can be extended if the user's organization requires different data than the ones provided by the default report.

Contact us

 

Care to share?
   
Picture of Vivek Tiwari
Published July 2, 2020

Vivek Tiwari

Vivek is an Integration Consultant at Yenlo and has more than nine years experience as a software consultant.

Responses

Stay up to date with the latest articles