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 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 )
  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.

  • 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"
  }
}'
 Click here for sample cURL commands:
curl -v -X POST \
  http://localhost:8280/http-analytics_rule_one_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_rule_one_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_rule_one_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 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 )
  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. Information is displayed in the widgets as shown below.
  • No labels