SummaryReport

SummaryReport objects are used to report on activity captured within a reporting interval.

Properties

  • ReportKey key: Identifier describing the scope covered by this report.

  • java.util.Date endTime: End of the period covered by this report.

  • SummaryCollector collector: Collector that generated this report.

  • HVEvent lastEvent: A copy of the last event captured during the interval of this report.

  • SummaryStats overall: Overall statistics for this report.

  • java.util.Map<String,summary_stats> rangeStats: Map of SummaryStat for each range that had activity. Map key is the name of the configured ResponseTimeRange.

  • String[] reportingMonitors: List of monitors that contributed to this report.

  • String[] nonreportingMonitors: List of monitors in the group that could not be contacted when this report was assembled.

Methods

  • String toString(): Returns a string representation of this object.

Description

SummaryReport objects are used to report on activity captured within a reporting interval. Deployed SummaryCollector objects generate a separate report for each unique set of grouping field values and pass them to the collector’s onreport event handler. The key.groupValues property specifies the set of unique values that define the scope of the report. If the collector does not define any grouping fields, it produces a single report per interval in which it saw activity with no specified key.groupingValues.

Each report instance captures the overall statistics, as well as statistics for any defined ranges where at least one hit fell within the range’s constraints. Report data is not generated for grouping values that saw no activity or for ResponseTimeRanges that saw no activity.

The example for SummaryReport (see Example) defines a SummaryCollector with a one-minute interval for which it reports any activity observed to the processPageStats function. This collector groups information by page title, so for each unique page title appearing in an HVEvent during the interval, the collector generates a report, with the name of the page being reported on specified in report.key.groupValues[0].

As this custom handler receives these reports, it generates metrics elements that will appear on a connected Operations Center server. As this script is written, the element name will match the page title, and will appear under Experience Manager_adapter_element/Metrics/Page Stats/page_title in the element tree. The properties page for this element will have data mined from the Summary Reports. (It can presumably also have Series data showing a history of the page performance, but that logic is omitted here for simplicity.)

The example also implements custom logic for driving the condition of the element. The collector defines a set of ranges that presumably have business meaning in the context of the site being monitored. Based on the relative number of hits in each of these ranges, the script assigns an appropriate condition and message (description) for the element.

Example

var collector = metrics.createSummaryCollector('Page Stats', 60000,
                processPageStats);
collector.groupingFieldNames=[metrics.constants.FN_PAGE_TITLE];
var targetRange = metrics.createResponseTimeRange('target', 0, 1500);
var acceptRange = metrics.createResponseTimeRange('accept', 1500, 4000);
var problemRange = metrics.createResponseTimeRange('problem', 4000, 60000);

collector.ranges=[targetRange,acceptRange,problemRange];

// ... add other collector props and deploy

function processPageStats(reports)
{
   for(var i=0; i < reports.length;i++)
   {
      var report = reports[i];
      // create element and automatically map stats into series data.
      var elem = metrics.createMetricsElement()
      elem.elementKeys=[report.key.collectorName, report.key.groupValues[0]];
      assignConditonAndMessage(elem, report);
      elem.properties.put('Reference URL', report.lastEvent.URL);
      elem.properties.put('Page Title', report.lastEvent.title);
      elem.properties.put('Hit Count', report.overall.count);
      // mine other properties ..
      metrics.sendMetricsElement(elem);
      
   }
}

/*
 * calculate element condition based on relative hit count
 */
function assignConditonAndMessage(elem,report)
{
   var targetHits = getRangeHitCount(report,'target');
   var acceptHits = getRangeHitCount(report,'accept');
   var problemHits = getRangeHitCount(report,'problem');
   
   if(targetHits > acceptHits + problemHits)
   {
      elem.condition=metrics.constants.SEV_OK;
      elem.message = 'Performance target achieved';
   }
   else if (targetHits  > problemHits || acceptHits > problemHits)
   {
      elem.condition = metrics.constants.SEV_MINOR;
      elem.message = 'Performance acceptable';
   }
   else if (targetHits + acceptHits > problemHits)
   {
      elem.condition = metrics.constants.SEV_MAJOR;
      elem.message = 'Performance degraded';
   }
   else 
   {
      elem.condition = metrics.constants.SEV_CRITICAL;
      elem.message = 'Performance violation';
   }
   elem.message += ': T=' + targetHits + ' A='+ acceptHits + ' P=' + problemHits;
}
/*
 * Return hit count if range has data, or 0 if it does not
 */
function getRangeHitCount(report, rangeName)
{
   var hitCount = 0;
   var rangeStats = report.rangeStats.get(rangeName);
   if(rangeStats != null)
   {
      hitCount =  rangeStats.count;
   }
   return hitCount;
}