HTTP Analytics
HTTP Analytics is an analytics solution powered by WSO2 Stream Processor. It is packed with WSO2 Stream Processor by default. It allows you to monitor your HTTP analysis data by visualizing them in a preconfigured dashboard.
To use this solution to view HTTP analytics data in the HTTP Analytics dashboard, follow the steps below.
Step 1: Set up HTTP Analytics
This step involves defining a source to specify how the HTTP request events analyzed via this solution need to be captured and defining a store to store the events to be analyzed as per your business requirement. To do this, let's define a business rule via the WSO2 SP Business Rules Manager as follows. For more information, see Creating Business Rules.
- In your terminal, navigate to the
<SP_HOME>/bin
directory. Then issue one of the following commands to start the dashboard server.- On Windows:
dashboard.bat --run
- On Linux/Mac OS:
./dashboard.sh
- On Windows:
- Start a WSO2 SP worker runtime by issuing one of the following commands from the
<SP_HOME>/bin
directory.- On Windows:
worker.bat --run
- On Linux/Mac OS:
./worker.sh
- On Windows:
- Access the Business Rules Manager via one of the following URLs.
- For HTTP:
http://<SP_HOST>:<HTTP_PORT>/business-rules
(e.g.,http://0.0.0.0:9090/business-rules
) - For HTTPS:
https://<SP_HOST>:<HTTPS_PORT>/business-rules
(e.g.,https://0.0.0.0:9443/business-rules
)
- For HTTP:
- If you do not have any business rules that are already created, click Create. If there are existing rules, click + to create a new rule.
- Click Template to create the business rule from the business template that is already available in the HTTP Analytics solution.
- Click on HTTP-Analytics to create your business rule from the HTTP Analytics template group.
This opens the HTTP-Analytics page. Select the HTTP-Analytics-Processing template in the RuleTemplate field.
This opens the predefined fields of the HTTP-Analytics-Processing template. To define the business rule, enter information in the fields displayed as follows:
Field Description Default Business Rule Name A unique name for the business rule. N/A This specifies the source definition via which the HTTP events are received. For more information about sources, see Siddhi Query Guide - Source. type='http', @map(type='json')
Store for HTTP Analytics This specifies a store definition to store the processed events received via HTTP. For more information about storing data, see Siddhi Query Guide - Store Query. type="rdbms",datasource="HTTP_ANALYTICS_DB"
If this is set to Yes
, the system time is used for aggregation. If this is set toNo
, the timestamp from the arrived event is used for aggregation.Yes - Click SAVE & DEPLOY.
Step 2: View HTTP Analysis data
Before you begin:
In order to view information in the HTTP Analytics dashboard, issue some sample cURL commands to generate events. The cURL commands can be of the following format.
- When sending multiple requests to ensure that timestamp is changed so that the later requests have higher timestamp value.
- If Yes is selected for the Use system time for aggregation field
curl -v -X POST \ http://<HOST>:8280/<NAME_OF_CREATED_BUSINESS_RULE>_0/RequestsStream \ -H 'content-type: application/json' \ -d '{ "event": { "timestamp": <CURRENT_TIMESTAMP_IN_MILLISECOND>*, "serverName": "localhost", "serviceName": "A", "serviceMethod": "GET", "responseTime": 1000.00, "httpResponseCode": 200, "userAgent": "Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405", "requestIP": "127.0.0.1" } }'
To view information in the HTTP Analytics dashboard, follow the procedure below:
- Access the Dashboard Portal via one of the following URLs.
http://<SP_HOST>:<HTTP_PORT>/portal
(e.g.,http://localhost:9290/portal
)https://<SP_HOST>:<HTTPS_PORT>/portal
(e.g.,https://localhost:9643/portal
)
- Log in with your credentials. The HTTP Analytics dashboard is included in the dashboard listing as shown below.
- Click on the HTTP Analytics dashboard to open it. Information is displayed in the widgets as shown below.