This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Using the Analytics Dashboard

The Analytics profile of WSO2 Enterprise Integrator (WSO2 EI) allows you to publish the statistics relating to the message mediation in WSO2 EI and to analyze them using the Analytics Dashboard. Once the data from the mediation artifacts are published to the Analytics profile, the dashboard will provide an overview of the mediation artifacts as well as separate statistics on each of the artifacts.

In this tutorial, you will use the EI-Analytics dashboard to view and analyze the mediation statistics from the Exposing Several Services as a Single Service tutorial.

Before you begin,

  1. Install Oracle Java SE Development Kit (JDK) version 1.8.* and set the JAVA_HOME environment variable.
  2. Download the WSO2 EI ZIP file from here, and then extract the ZIP file. 
    The path to this folder will be referred to as <EI_HOME> through out this tutorial.
  3. Download the MSF4J service from here and copy the JAR file to the <EI_HOME>/wso2/msf4j/deployment/microservices folder. The back-end service is now deployed in the MSF4J profile of WSO2 EI.
  4. Select and download the relevant EI tooling ZIP file based on your operating system from here and then extract the ZIP file.
    The path to this folder will be referred to as <EI_TOOLING> through out this tutorial.
  5. Open the EI Tooling environment and click File -> Import. Then, select Existing WSO2 Projects into workspace under the WSO2 category, click Next and upload the extracted pre-packaged C-App project. This C-App contains the configurations of the service chaining tutorial. On the Servers tab, right-click the WSO2 EI server, select Add and Remove and choose SampleServicesCompositeApplication, and click Finish.

  6. If you are running on Windows, download the snappy-java_1.1.1.7.jar from here and copy the JAR file to <EI_HOME>\lib directory.

  7. When you are in a production environment, be sure to configure data purging for your analytics server before using analytics. Otherwise, too much data will get accumulated in the analytics server over time and cause performance issues.


Let's get started!

Setting up Analytics 

Set the following properties in the  <EI-HOME>/conf/synapse.properties  file to true so that the ESB profile can publish mediation statistics:


...
mediation.flow.statistics.enable=true
mediation.flow.statistics.tracer.collect.payloads=true
mediation.flow.statistics.tracer.collect.properties=true
...
mediation.flow.statistics.collect.all=true


Starting the servers

Let's start the AnalyticsESB and MSF4J profiles as follows:

Be sure to start the Analytics profile first and then start the ESB profile.

  1. Start the Analytics runtime by going to <EI_HOME>/wso2/analytics/bin and using the command line terminal and executing one of the following commands:

    • On Linux/Mac OS:  sh wso2server.sh
    • On Windows:  wso2server.bat --run

  2. Start the ESB runtime from within Tooling. For instructions, see Starting the Integrator runtime and deploying the artifacts.
  3. Start the MSF4J runtime to the back-end service (which is an MSF4J service) by going to <EI_HOME>/wso2/msf4j/bin and executing one of the following command:

    • On Linux/Mac OS: sh carbon.sh
    • On Windows: carbon.bat --run

Enabling statistics and tracing for the artifacts

Follow the steps below to enable statistics and tracing for the REST API:

  1. Go to the management console of the ESB profile.
  2. On the Main tab of the management console, go to Manage -> Service Bus and click APIs. The Deployed APIs screen appears, and you will see the HealthcareAPI listed as follows:
  3. To enable the collection of mediation statistics for the REST API, click Enable Statistics.
  4. To enable mediation tracing for the REST API, click Enable Tracing.

    Note that it is not recommended to enable tracing in production environments as it generates a large number of events that reduces the performance of the analytics profile. Therefore, tracing should only be enabled in development environments.

Follow the steps below to enable statistics for the endpoints:

  1. On the Main tab of the management console, go to Manage -> Service Bus, and click Endpoints. The Manage Endpoints screen appears, and you will see several endpoints listed.
  2. To enable the collection of mediation statistics for the endpoints, click Enable Statistics for each endpoint.

Sending a message

Now that you have the artifacts deployed and configured for statistics monitoring, send a request to the ESB profile.

  1. Create a JSON file called request.json with the following request payload.

    {
    "name": "John Doe",
    "dob": "1940-03-19",
    "ssn": "234-23-525",
    "address": "California",
    "phone": "8770586755",
    "email": "johndoe@gmail.com",
    "doctor": "thomas collins",
    "hospital": "grand oak community hospital",
    "cardNo": "7844481124110331",
    "appointment_date": "2017-04-02"
    }
  2. Open a command line terminal and execute the following command from the location where you save the request.json file:

    curl -v -X POST --data @request.json http://localhost:8280/healthcare/categories/surgery/reserve --header "Content-Type:application/json"

    If the message mediation is successful, you will see the following response:

    {"appointmentNo":1,
    "doctorName":"thomas collins",
    "patient":"John Doe",
    "actualFee":7000.0,
    "discount":20,
    "discounted":5600.0,
    "paymentID":"e1a72a33-31f2-46dc-ae7d-a14a486efc00",
    "status":"Settled"}

Analyze the mediation statistics

Now, let's analyze the statistics generated from the message mediation:

  1. In a new browser window or tab, open  https://localhost:9444/carbon/  and log into the Analytics management console using admin for both the username and password.
  2. On the Main tab, click Analytics Dashboard and log in using admin for both the username and password. You will then see the following:
     
  3. Click View to open the EI-Analytics Dashboard. The OVERVIEW page is displayed by default. 

  4. To view statistics for the REST API, click API on the left navigator and search for HealthcareAPI . For more information on analyzing statistics displayed on this page, see Analyzing Statistics for REST APIs.

  5. To view statistics for an endpoint, click ENDPOINT on the left navigator and search for the required endpoint. You can view statistics for the following endpoints on this page:
    • GrandOaksEP
    • ChannelingFeeEP
    • SettlePaymentEP
  6.  For more information on analyzing statistics displayed on this page, see Analyzing Statistics for Endpoints.

    You have now explored how to use EI-Analytics dashboard.