This documentation is for WSO2 Stream Processor 4.2.0. View documentation for the latest release.

All docs This doc
||
Skip to end of metadata
Go to start of metadata

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.

  1. In your terminal, navigate to the <SP_HOME>/bin directory. Then issue one of the following commands to start the dashboard server.
    • On Windowsdashboard.bat --run
    • On Linux/Mac OS: ./dashboard.sh
  2. Start a WSO2 SP worker runtime by issuing one of the following commands from the <SP_HOME>/bin directory.
    • On Windowsworker.bat --run
    • On Linux/Mac OS./worker.sh
  3. Access the Business Rules Manager and log in with your credentials.
  4. 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.
     
  5. Click Template to create the business rule from the business template that is already available in the HTTP Analytics solution.
     
  6. 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.
  7. To define the business rule, enter information in the fields displayed as follows:

    FieldDescriptionDefault
    Business Rule NameA 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 AnalyticsThis 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 to No, the timestamp from the arrived event is used for aggregation.Yes
  8. 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.

  • The <NAME_OF_CREATED_BUSINESS_RULE> will be the rule name in all simple case separated by "-", for example, if you have given the rule name as "HTTP Analytics" then you should use the rule name as "http-analytics_0".
  • If Yes is selected for the Use system time for aggregation field or the property and if multiple requests are sent, ensure that timestamp is changed so that the later requests have higher timestamp value.
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"
  }
}'
 Click here for sample cURL commands:
curl -v -X POST \
  http://localhost:8280/http-analytics_0/RequestsStream \
  -H 'content-type: application/json' \
  -d '{
  "event": {
    "timestamp": 1528795987,
    "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"
  }
}'
curl -v -X POST \
  http://localhost:8280/http-analytics_0/RequestsStream \
  -H 'content-type: application/json' \
  -d '{
  "event": {
    "timestamp": 1528796173,
    "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"
  }
}'
curl -v -X POST \
  http://localhost:8280/http-analytics_0/RequestsStream \
  -H 'content-type: application/json' \
  -d '{
  "event": {
    "timestamp": 1528796439,
    "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:

  1. Access the Business Rules Manager and log in with your credentials.
  2. Log in with your credentials. The HTTP Analytics dashboard is included in the dashboard listing as shown below.
  3. Click on the HTTP Analytics dashboard to open it. Then select the required time range in the Date Time Range widget. You can click on a time range displayed on the widget (e.g., 1 MONTH to view statistics for a period of one month of which the current data is the last date), or click CUSTOM and enter a custom date interval as shown in the example below.


    Information is displayed in the widgets as shown below.
  • No labels