Monitoring Ensemble
Monitoring Activity Volume
Go to:

The Activity Volume Statistics and Monitoring package provides short-term monitoring of system performance and long-term reporting on message traffic.

This chapter contains:
Activity Monitoring Overview
Activity monitoring can be useful for tasks such as:
The Activity Monitoring package provides:
This package stores summary statistics that contain information such as the number of messages that pass through a configuration component and the average time to process the message. This summary information is stored in a compact, efficient manner and can be maintained over very long periods of time without requiring extensive amounts of storage.
The monitor provided with this feature allows you to display the current data over several different time periods. But the statistics stored in the database provide a richer set of data. You can use the analysis and reporting tools of your choice to analyze long-term trends or to compare the volume trends during peak traffic times. This capability allows you to analyze and troubleshoot problems with overloaded components and to track long-term load changes so that you can provide additional resources before problems develop.
All classes that inherit from Ens.BusinessService, Ens.BusinessProcess, or Ens.BusinessOperation can use the built-in activity monitoring. In addition, you can use custom code to include custom data in your activity monitoring.
The Activity Volume Statistics and Monitoring package allows you to monitor multiple namespaces running on a single instance of Ensemble and collect the statistics from these namespaces in a single database.
The DeepSee dashboard user interface supports the ability to display statistics from multiple instances of Ensemble, but the mechanism to gather statistics from multiple instances is experimental and should not be used in production environments.
Enabling Activity Monitoring
You can monitor activity for a single namespace or for multiple namespaces that are running on the same instance of Ensemble. To enable activity monitoring, follow this procedure:
  1. For each namespace that you want to monitor:
    1. Add the Ens.Activity.Operation.Local business operation to the production in the namespace.
    2. Configure the operation so that it specifies the namespace in which you will be collecting the statistics.
    3. Enable the operation.
    4. To enable statistics collection for all configuration items in the production, call the EnableStatsForProduction() method or, to enable statistics collection for individual configuration items, call the EnableStatsForConfig() method. For example, to enable statistics collection for all production configuration items in the ENSDEMO namespace, enter the following in Terminal:
      zn "ENSDEMO"
      do ##class(Ens.Util.Statistics).EnableStatsForProduction()
  2. Create or select an existing Ensemble namespace to use for data collecting. If you are only collecting activity data from a single namespace, you can select that namespace to collect the data or you can create a new one. If you are collecting data from multiple namespaces, we recommend that you create a new namespace and only use it for collecting the statistics.
  3. Make it possible to use DeepSee to access to the data by enabling DeepSee in the namespace’s default web application. To do this:
    1. Select the default web application for the namespace. For example, if the namespace is WATCHACTIVITY, the default web application is typically /csp/watchactivity.
    2. Select the DeepSee check box.
    3. Select Save.
Using the Activity Monitor Dashboard
The Activity Monitor Dashboard is a DeepSee dashboard that displays the activity statistics. To go to the dashboard, ensure that you are in the namespace being used to collect statistics and select Ensemble > Monitor > Activity Volume and Duration. The dashboard is defined in the class Ens.DeepSee.ActivityVolumeAndDurationDashboard .
The dashboard displays current activity information for each production configuration item.
You can select the statistics to display by time period, instance, namespace, and site dimension:
You can sort the statistics by: Name, Total Count, Avg. Duration, or Avg. Queue Time.
The dashboard automatically refreshes every 60 seconds. You can also refresh it by selecting Refresh. The Reset button resets the selection fields to their initial default values.
For each configuration item reporting statistics, the dashboard displays the following information:
Although this dashboard can only display activity for the previous minute, hour, day, week, month, or year, you can design your own dashboard with more flexibility. For example, you could create a dashboard that displays the activity from 9AM to 6PM for a specified day.
Writing Custom Code to Record Activity
In addition to using the built-in statistics mechanism, you can write custom code to:
To specify the site dimension to be recorded with the statistics, use the SetStatsUserDimension() method. For example, the following code first checks that statistics are enabled and then it sets the site dimension to “CriticalAction”.
 If ##class(Ens.Util.Statistics).StatsStarted(..%ConfigName) {
  Do ##class(Ens.Util.Statistics).SetStatsUserDimension(..%ConfigName,"CriticalAction")
The RecordStats() method writes the specified statistics data to the temporary storage. The data will be aggregated to the three tables. Consider the following example:
Do ##class(Ens.Util.Statistics).RecordStats(0,"IncomingMsgSrvc","ActiveMsgs",1,4087,35)
The parameters have the following meaning:
Accessing the Activity Monitor Database
The activity statistics are stored in these three tables. The three tables contain the data about the same activity, but using a different time period to aggregate the data. The three tables are:
This redundancy in storage provides the flexibility to minimize the long-term storage required for the statistics without losing the ability to examine historic data. For example, you can use the Ens_Activity_Data.Seconds table to closely examine activity over the previous two days but purge data after two days to minimize storage. The Ens_Activity_Data.Hours and Ens_Activity_Data.Days tables store less data and can be purged much less frequently. You can use the Ens_Activity_Data.Hours table to examine how activity changes over the course of a day. For example, you could use it to generate a report of the peak activity periods during each day of the week and the impact it has on delays and queue sizes.
Purging the Activity Monitor Database
Although the tables storing the activity statistics data are much smaller than the total size of the corresponding messages, you should purge the activity statistics tables on a regular basis. The PurgeActivityData task purges the specified activity table. You specify the amount of data to keep by specifying a number and a time unit. For example, you could retain 7 days of data for the Seconds table, 12 months of data for the Hours table, and 3 years of data for the Days table.
For details on how to create a task, see Using the Task Manager in Managing Caché.