Using the Analytics Dashboard
The Analytics profile of WSO2 Enterprise Integrator (WSO2 EI) allows you to publish the message mediation related statistics 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,
- Download the product installer from here, and run the installer.
Let's call the installation location of your product the<EI_HOME>
directory.Note that if you used the product installer to install your product, the
<EI_HOME>
is located in a place specific to your OS as shown below:OS Home directory Mac OS /Library/WSO2/EnterpriseIntegrator/6.3.0
Windows C:\Program Files\WSO2\EnterpriseIntegrator\6.3.0\
Ubuntu /usr/lib/wso2/EnterpriseIntegrator/6.3.0
CentOS /usr/lib64/EnterpriseIntegrator/6.3.0
- 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. 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>
throughout this tutorial.- For more detailed installation instructions, see the Installing Enterprise Integrator Tooling.
- Getting an error message? See the troubleshooting tips given under Installing Enterprise Integrator Tooling.
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.
If you do not have a server added in Eclipse, refer this tutorial.
You can also deploy the artifacts to the Integration server using a Composite Application Archive (CAR) file.
- 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. 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 Analytics, ESB, and MSF4J profiles as follows:
Be sure to start the Analytics profile first and then start the ESB profile.
Start the Analytics profile:
- Start the ESB runtime from within Tooling. For instructions, see Starting the Integrator runtime and deploying the artifacts.
Start the back-end service (which is an MSF4J service):
Enabling statistics and tracing for the artifacts
Follow the steps below to enable statistics and tracing for the REST API:
- Go to the management console of the ESB profile:
https://localhost:9443/carbon
- 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 theHealthcareAPI
listed as follows:
- To enable the collection of mediation statistics for the REST API, click Enable Statistics.
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:
- 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. - 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.
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" }
- 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:
- In a new browser window or tab, open
https://localhost:9444/carbon/
and log into the Analytics management console usingadmin
for both the username and password. - On the Main tab, click Analytics Dashboard and log in using
admin
for both the username and password. You will then see the following:
Click View to open the EI-Analytics Dashboard. The OVERVIEW page is displayed by default.
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.
- 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
You have now explored how to use EI-Analytics dashboard.