KPI Sample Guide

Key Performance Indicators are quantifiable measurements that reflect the critical success factors of an organization. They will differ depending on the organization.

This sample develops and visualizes couple of KPIs (Key Performance Indicator) for a retail store. The developed KPIs are
  1. Quantity sold for each product.
  2. Number of orders received by each customer.

Sample Guide

  1. Start BAM server with default settings.

  2. Run the ant script in ${BAM_HOME}/samples/kpi-definition directory, by typing ant in the console. This will simulate another server (ex: WSO2 AS) pumping in events.

  3. Log in to BAM console and go to Configure --> Connection Parameters left menu item.

  4. Submit following default connection parameters for Connection Paramters and submit.
    			Username : admin
    			Password : admin
    		    
    These are the connection parameters which are used to connect to embedded Cassandra instance from analyzers.

  5. Click on "Add Sequence" to add a new analyzer sequence.

  6. Copy UserSummarizer.xml content and paste it in the "source" tab of analyzer design view.

  7. UserSummarizer Analyzer

  8. Save the analyzer.

  9. Add other sequence (ProductSummarizer.xml) by following same steps for UserSummarizer.xml.

  10. Now wait for the analyzers to run. Once they run they will print out the results to the console as follows.


  11. Results

  12. Now it's required to create indexes in order to facilitate quering summarized data. Go to Configure --> BAM Database left menu item and click "Add Index" in the "Indexes" tab.

  13. Give the values shown as below screenshot in the "Add Index" ui to create an index of users in 'userSummary' table created by 'UserSummarizer' analyzer sequence.

  14. Add Index

  15. Also create an index on 'productSummary' table by providing the following.
    			Index Name : ProductIndex
               		Indexed Table : productSummary
                		Indexed Columns : item
    		    

  16. Now it is required to create the gadgets which would visualize information by pulling out data from Cassandra using defined indexes. Now in order to create the gadgets go to Configure --> Gadget IDE left menu item.

  17. Add "Cassandra Data Source" by clicking left menu. Give following in the Cassandra data source and click 'load'.
    			Table Name : userSummary
    			Table Index Name : UserIndex
    			index : user
    		    
    Note how these values corresponds to values given at index creation time. Now data source inputs and outputs should show up like this.

  18. Cassandra Data Source

  19. Now to provide data from Cassandra to a bar chart add a bar chat element by clicking "Bar Chart" left menu item. Position and re-size bar chart appropriately in "Design" tab and also in "Data Flow" tab.

  20. Design View

  21. Now to plot request count against each user, wire the "user" output of Cassandra data source to "label" input of Bar chart and "request_count" output of Cassandra data source to "values" input of Bar chart.
  22. Flow
  23. Now the the bar char should be visible at the "Design" tab.

  24. Bar Chart

  25. Now the gadget design is complete. Next step is to publish the gadget to the dashboard. Go to "Settings" tab in left menu and give the gadget name as userSummary and publish.

  26. Publish Gadget

  27. Now the gadget is generated and uploaded to the registry. To upload the gadget from registry to dashboard go to Main --> BAM Dashboard left menu item and click "Add Gadgets". Give the gadget URL as "/registry/resource/_system/config/repository/dashboards/gadgets/userSummary.xml" and add the gadget.

  28. Now the gadget would show up in the dashboard.

  29. It's possible to wire other types of charts (e.g. : pie chart) and create gadget with the same Cassandra data source we have added. Add wiring to the new chart from Cassandra data source accordingly and publish using the same procedure above. Also data from 'productSummary' table can also be visualized by following the same steps from 14 to 17 while changing the following at Cassandra Datasource.
    			Table Name : productSummary
    			Table Index Name : ProductIndex
    			index : item