com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_link3' is unknown.

Monitoring WSO2 ESB with WSO2 ESB Analytics

This section demonstrates a scenario where WSO2 ESB interacts with a simple Axis2 service when a client sends JSON messages. The ESB artifact used are then monitored by WSO2 Analytics - ESB.

In this scenario, a JSON client needs to connect with a Stockquote service. The client can send requests that contain company names in JSON format. However, the backend server can only serve SOAP messages. WSO2 ESB carries out the mediation so that the client can communicate with the backend server.

WSO2 Analytics collects the statistics for the REST API and the 5 mediators with which the mediation is performed, and presents them in the WSO2 Analytics Dashboard.

Follow the steps below to try this scenario.

Prerequisites

In order to try this tutorial, you need to download and install the following WSO2 products from here.

  • WSO2 Enterprise Service Bus: To download this, click DOWNLOAD.
  • WSO2 Analytics - ESB - To download this, click Analytics.

Step 1 - Configure WSO2 ESB to publish statistics

This step involves doing the required configurations to ensure that statistics are published in the WSO2 Analytics Dashboard when you invoke the StockQuote service.

Enable mediation statistics and message tracing by setting the following properties in the <ESB_HOME>/repository/conf/synapse.properties file.

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

Step 2 - Deploy the required ESB artifacts

This step involves uploading the ESB artifacts required for this scenario using a CAR file.

  1. Download and save ESB_Artifacts_1.0.0.car in a preferred location in your computer.
  2. Start the WSO2 ESB Analytics server with one of the following commands.

    • On Windows: <ESB_ANALYTICS_HOME>\bin\wso2server.bat --run
    • On Linux/Solaris/Mac OS: sh <ESB_ANALYTICS_HOME>/bin/wso2server.sh

    The WSO2 ESB Analytics server needs to be started before the WSO2 ESB server in order to be updated with ESB statistics when they are published.

  3. Start WSO2 ESB with one of the following commands.
    • On Windows: <ESB_HOME>\bin\wso2server.bat --run
    • On Linux/Solaris/Mac OS: sh <ESB_HOME>/bin/wso2server.sh

  4. Log into the WSO2 ESB Management Console using the following URL.
    https://<ESB_HOST>:<ESB_PORT>/carbon/
  5. In the Main tab, click Add under Carbon Applications. This opens the Add Carbon Applications page.
  6. Click Browse, and browse for the ESB_Artifacts_1.0.0.car file you saved in your computer. Then click Upload.
  7. In the Main tab, click APIs to open the Deployed APIs page. An API named StockQuoteAPI. Enable statistics and tracing for this API by clicking Enable Statistics and Enable Tracing.

Step 3 - Set up the Stockquote service

Follow the procedure below to start the axis2 server for the Stockquote service that is invoked by the client in this scenario.

  1. Issue the following command from the <ESB_HOME>/samples/axis2Server/src/SimpleStockQuoteService directory.
    ant
  2. Issue the following command from the <ESB_HOME>/samples/axis2Server directory.
    ./axis2server.sh

Step 4 - Send JSON requests

In this step, 40 requests are sent to the Stockquote service. For the purpose of demonstrating how successful messages and message failures are illustrated in the Analytics Dashboard, 10 of the requests are sent while the axis2 server is not running. This should generate a success rate of 75% for the StockQuoteAPI REST API.

  1. Issue the following cURL command from your terminal to invoke the StockQuoteAPI REST API and get stock quotes from the Stockquote service. Send 30 requests.

    curl -X POST http://localhost:8280/stockquote/getQuote -d '{"name":"WSO2"}' -H "Content-Type:application/json"
  2. Stop the axis2 server that you previously started.
  3. Send 10 more requests using the cURL command given above.

Step 5 - Analyze statistics

The following assumptions are made in this section because the manner in which information in the Analytics Dashboard changes depending on the time gaps between requests sent to the ESB, and the time gap between sending requests and viewing the Analytics Dashboard.

  • All 10 requests are sent within one hour, and the Analytics Dashboard is viewed within the same hour.
  • The activities described in this use case are the only activities you have carried out in WSO2 ESB during the last hour before you view the Analytics Dashboard.

Follow the procedure below to access the WSO2 Analytics Dashboard and analyze the ESB statistics published in it.

  1. Log into the WSO2 Analytics - ESB Management Console using the following URL.
    URL: https://<ESB_Analytics_HOST>:<ESB_Analytics_PORT>/carbon/
  2. In the Main tab, click Analytics Dashboard. Then log into the Analytics Dashboard by entering admin as both the username and the password. This opens the Dashboards page where the ESB Analytics dashboard is displayed as follows.
  3. Click View to open the dashboard. Then click Last Hour. The following is displayed.
    • The request count is displayed as 40. The success rate of 75% is displayed because out of the 40 requests, only 30 were sent while the axis2 server for the Stockquote service was running.
    • The number of transactions handled by the ESB per second is mapped on a graph as follows.
    • The success rate and the failure rate of the messages received by the ESB during the last hour are mapped in a graph as follows.
    • The StockQuoteAPI REST API is displayed under TOP APIS BY REQUEST COUNT as follows.
  4. In the Top APIS BY Request COUNT gadget, click StockquoteAPI to open the OVERVIEW/API/STOCKQUOTEAPI page. The following is displayed.
    • The API REQUEST COUNT gadget shows the total number of requests handled by the StockQuoteAPI REST API during the last hour as 40. The success rate is displayed as 75% because only 30 out of the 40 requests were sent while the axis2 server was running.
    • The MESSAGE COUNT gadget maps the number of successful messages as well as failed messages at different times within the last hour in a graph as shown below.
       
    • The MESSAGE LATENCY gadget shows the speed with which the messages are processed by mapping the amount of time taken per message at different times within the last hour as shown below.
       
    • The MESSAGES gadget lists all the the messages handled by the StockQuoteAPI REST API during the last hour with the following property details as follows.

      PropertyDescription
      Message IDUnique ID to identify a request
      HostIP address of the WSO2 ESB runtime instance, which receives the actual request
      Start TimeThe time when the request reached the Synapse mediation engine
      StatusIf the flow of request is successfully completed or not

       

    • The MESSAGE FLOW gadget illustrates the order in which the messages handled by the StockQuoteAPI REST API within the last hour passed through all the mediation sequences, mediators and endpoints that were included in the message flow as shown below.
       
  5. Click on a message ID in the MESSAGES gadget to open the OVERVIEW/MESSAGE/<MESSAGE_ID> page. The following is displayed.
    • The MESSAGE FLOW gadget illustrates the order in which the messages handled by the StockQuoteAPI REST API within the last hour passed through all the mediation sequences, mediators and endpoints that were included in the message flow as shown below.
       
    • Click PayloadFactoryMediator in the MESSAGE FLOW gadget. As a result, the MEDIATOR PROPERTIES gadget illustrates the processing carried out by the Payload Factory mediator selected by displaying the payload, transport properties and context properties in the message flow both before the mediator and after the mediator as shown below.
       
com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.