Vordel SDK

com.vordel.reporting.rtm.api
Class Metrics

java.lang.Object
  extended by com.vordel.reporting.rtm.api.Metrics

public class Metrics
extends java.lang.Object

This class contains a number of utility methods which allow the Metrics API user to retrieve the in-memory metrics for all the MetricGroup objects which the Gateway is currently recording metrics for.

Metrics totals may be retrieved. For incremental metrics of type MetricTypeValue, (e.g. numMessages), the metric values returned will be the total value since the Gateway started running. For measurement metrics also of type MetricTypeValue, the metric value returned is that value which was last set for that metric if the current value is being tracked. For metrics of type MetricTypeRangeCount the metric values returned are the total count for each range since the Gateway started. Where applicable, if a minimum, maximum or average is configured for the metric, these are overall minimum, maximum or averages calculated since the Gateway startup.

Metric time window values may also be retrieved. A time window is a period of time for which metrics are gathered before they get reset. If metrics are written to the database, this will be done at the end of the time window. (Note that the actual resetting of a metric at the end of a time window is dependent upon the type of the metric). The Gateway will maintain a set of time window metrics in-memory. If the time window period is 5-seconds, a list of maps of metrics may be retrieved where each entry in the list represents the metrics gathered for a single 5 second slot.

For example, say we wish to get the all of the current in-memory total metric values for a MetricGroup of type Service with a name StockQuote. The code is as follows:-

 MetricGroup serviceMetricGroup = new MetricGroup("StockQuote", "Service");
 HashMap totals = Metrics.getMetricGroupTotals(serviceMetricGroup);
 for (String metricName : metrics.keySet()) {
     System.out.println(metricName + "=" + metrics.get(metricName));
 }
  

Say we wish to get the current in-memory total metric value for the metric numMessages for a MetricGroup of type Service with a name StockQuote. The code to get the numMessages value as follows:-

  MetricGroup serviceMetricGroup = new MetricGroup("StockQuote", "Service");
  int numMessages = new Integer(Metrics.getMetricGroupTotals(serviceMetricGroup).get("numMessages")).intValue();

See method descriptions below for more information on the data returned via these utility methods.

See Also:
MetricGroup.

Constructor Summary
Metrics()
           
 
Method Summary
static java.util.List<java.util.HashMap<java.lang.String,java.lang.Object>> getAllMetricGroupTotals()
          Retrieve a list of maps of metrics totals for all in-memory MetricGroups.
static java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> getEvents(java.lang.String type)
          Retrieve a list of maps of events by type.
static java.util.List<java.util.HashMap<java.lang.String,java.lang.Object>> getMetricGroupTimeWindows(long groupId, int twTypeId)
          Retrieve a list of maps of time window metrics for the MetricGroup.
static java.util.List<java.util.HashMap<java.lang.String,java.lang.Object>> getMetricGroupTimeWindows(MetricGroup metricGroup, int twTypeId)
          Retrieve a list of maps of time window metrics for the MetricGroup.
static java.util.List<java.util.HashMap<java.lang.String,java.lang.Object>> getMetricGroupTimeWindows(java.lang.String groupName, java.lang.String groupType, int twTypeId)
          Retrieve a list of maps of time window metrics for the MetricGroup.
static java.util.HashMap<java.lang.String,java.lang.Object> getMetricGroupTotals(int metricGroupId)
          Retrieve a map of metrics totals for a MetricGroup.
static java.util.HashMap<java.lang.String,java.lang.Object> getMetricGroupTotals(MetricGroup metricGroup)
          Retrieve a map of metrics totals for the MetricGroup.
static java.util.HashMap<java.lang.String,java.lang.Object> getMetricGroupTotals(java.lang.String groupName, java.lang.String groupType)
          Retrieve a map of metrics totals for a MetricGroup.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Metrics

public Metrics()
Method Detail

getMetricGroupTotals

public static java.util.HashMap<java.lang.String,java.lang.Object> getMetricGroupTotals(MetricGroup metricGroup)
Retrieve a map of metrics totals for the MetricGroup. The metrics are returned in a HashMap where the keys are the names of the metrics, e.g. numMessages, and the values are the current total value for that metric. A value is returned for each MetricType that is associated with the MetricGroupType of the MetricGroup. In addition values are returned for the following:-

For a MetricGroup of type Service, the data returned in the HashMap might look like this:-

 groupType=Service
 exceptions=0
 failures=0
 groupId=11
 groupName=StockQuote
 numMessages=21
 processingTimeMin=0
 successes=0
 processingTimeMax=0
 uptime=14037
 processingTimeAvg=0
 

Parameters:
metricGroup - The MetricGroup whose metrics to request
Returns:
The current totals metrics

getMetricGroupTimeWindows

public static java.util.List<java.util.HashMap<java.lang.String,java.lang.Object>> getMetricGroupTimeWindows(MetricGroup metricGroup,
                                                                                                             int twTypeId)
Retrieve a list of maps of time window metrics for the MetricGroup. The metrics are returned in a List, where each entry is a HashMap and the keys are the names of the metrics, e.g. numMessages, and the values are the time window value for that metric. A value is returned for each MetricType that is associated with the MetricGroupType of the MetricGroup. A value for the timestamp is also returned which indicates the start time of the time window for that list entry.

For a MetricGroup of type Service, the data returned in the List of HashMaps might look like this:-

 {timestamp=1322840325, exceptions=0, failures=0, numMessages=0, processingTimeMin=0, successes=0, twl=5, processingTimeMax=0, processingTimeAvg=0}
 {timestamp=1322840320, exceptions=0, failures=0, numMessages=0, processingTimeMin=0, successes=0, twl=5, processingTimeMax=0, processingTimeAvg=0}
 {timestamp=1322840315, exceptions=0, failures=0, numMessages=0, processingTimeMin=0, successes=0, twl=5, processingTimeMax=0, processingTimeAvg=0}
 {timestamp=1322840310, exceptions=0, failures=0, numMessages=5, processingTimeMin=567, successes=5, twl=5, processingTimeMax=600, processingTimeAvg=590}
 ..
 ..
 

Parameters:
metricGroup - The MetricGroup whose metrics to request
twTypeId - The time window type, 0 for 5 secs, 1 for 5 mins, 2 for 1 hour
Returns:
The time window metrics

getAllMetricGroupTotals

public static java.util.List<java.util.HashMap<java.lang.String,java.lang.Object>> getAllMetricGroupTotals()
Retrieve a list of maps of metrics totals for all in-memory MetricGroups. The metrics are returned in a List, where each entry is a HashMap of metrics relating to a particular MetricGroup. In the HashMap of metrics, the keys are the names of the metrics, e.g. numMessages, and the values are the current total value for that metric. In addition values are returned for the following:-

The data returned in the List of HashMaps might look something like this:-

 {groupType=Clients, groupId=9, groupName=AccumalativeAuthenticatedClientsCount, numMessages=0, uptime=14218}
 {groupType=Services, groupId=10, groupName=AccumalativeWebServiceCount, numMessages=0, uptime=14218}
 {groupName=System overview, systemMemoryUsed=3216876, metricsStoreError=, cpuUsedMax=3, memoryUsedMin=109076, cpuUsedAvg=0, diskUsedPercent=30, exceptions=0, numMessagesProcessed=3, messageMonitoringEnabled=false, systemCpuAvg=9, metricsStoreFatalError=, metricsStoringEnabled=true, processSignature=Melissa-PC:VordelGateway, groupType=SystemOverview, failures=0, successes=3, serverTitle=VordelGateway, uptime=14218, numSLABreaches=0, serverHost=Melissa-PC, cpuUsedMin=0, memoryUsedMax=268384, groupId=8, numAlerts=0, monitoringEnabled=true, systemCpuMin=1, systemCpuMax=42, systemMemoryTotal=4193584, numClients=0, memoryUsedAvg=171496}
 {respTimeRange1=0, respTimeRange3=0, groupName=www.kirupafx.com:80, respTimeRange2=0, respTimeRange5=0, respTimeRange4=0, respTimeRange7=0, numReportedUps=0, respTimeRange6=0, respTimeRange9=0, respTimeRange8=0, volumeBytesOut=0, respTimeMax=0, respTimeMin=0, numInConnections=0, respTimeRange10=0, volumeBytesIn=0, numTransactions=0, groupType=TargetServer, respTimeAvg=0, numReportedDowns=0, uptime=14232, respStatRange5=0, respStatRange2=0, respStatRange1=0, numOutConnections=0, respStatRange4=0, respStatRange3=0, groupId=6}
 {respTimeRange1=0, respTimeRange3=0, groupName=www.webservicex.com:80, respTimeRange2=0, respTimeRange5=0, respTimeRange4=0, respTimeRange7=0, numReportedUps=0, respTimeRange6=0, respTimeRange9=0, respTimeRange8=0, volumeBytesOut=0, respTimeMax=0, respTimeMin=0, numInConnections=0, respTimeRange10=0, volumeBytesIn=0, numTransactions=0, groupType=TargetServer, respTimeAvg=0, numReportedDowns=0, uptime=14232, respStatRange5=0, respStatRange2=0, respStatRange1=0, numOutConnections=0, respStatRange4=0, respStatRange3=0, groupId=7}
 {groupType=Service, exceptions=0, failures=0, groupId=11, groupName=StockQuote, numMessages=21, processingTimeMin=0, successes=0, processingTimeMax=0, uptime=14164, processingTimeAvg=0}
 {groupType=Client, exceptions=0, failures=0, groupId=17, groupName=admin, numMessages=1, successes=1, uptime=8}
 {groupType=Service, exceptions=0, failures=0, groupId=15, groupName=TopMovies, numMessages=1, processingTimeMin=3865, successes=1, processingTimeMax=3865, uptime=10, processingTimeAvg=3865}
 {groupType=ServiceUsagePerClient, exceptions=0, failures=0, groupId=16, groupName=admin, numMessages=1, processingTimeMin=3865, successes=1, processingTimeMax=3865, uptime=10, groupParentId=15, processingTimeAvg=3865}
 ..
 ..    
 

Returns:
The current totals metrics for all MetricGroups.

getMetricGroupTotals

public static java.util.HashMap<java.lang.String,java.lang.Object> getMetricGroupTotals(int metricGroupId)
Retrieve a map of metrics totals for a MetricGroup. The metrics are returned in a HashMap where the keys are the names of the metrics, e.g. numMessages, and the values are the current total value for that metric. A value is returned for each MetricType that is associated with the MetricGroupType of the MetricGroup. In addition values are returned for the following:-

For a MetricGroup of type Service, the data returned in the HashMap might look like this:-

 groupType=Service
 exceptions=0
 failures=0
 groupId=11
 groupName=StockQuote
 numMessages=21
 processingTimeMin=0
 successes=0
 processingTimeMax=0
 uptime=14037
 processingTimeAvg=0
 

Parameters:
metricGroupId - The id of the MetricGroup whose metrics to request.
Returns:
The current totals metrics

getMetricGroupTotals

public static java.util.HashMap<java.lang.String,java.lang.Object> getMetricGroupTotals(java.lang.String groupName,
                                                                                        java.lang.String groupType)
Retrieve a map of metrics totals for a MetricGroup. The metrics are returned in a HashMap where the keys are the names of the metrics, e.g. numMessages, and the values are the current total value for that metric. A value is returned for each MetricType that is associated with the MetricGroupType of the MetricGroup. In addition values are returned for the following:-

For a MetricGroup of type Service, the data returned in the HashMap might look like this:-

 groupType=Service
 exceptions=0
 failures=0
 groupId=11
 groupName=StockQuote
 numMessages=21
 processingTimeMin=0
 successes=0
 processingTimeMax=0
 uptime=14037
 processingTimeAvg=0
 

Parameters:
groupName - The name of the MetricGroup.
groupType - The name of MetricGroupType of the MetricGroup.
Returns:
The current totals metrics

getMetricGroupTimeWindows

public static java.util.List<java.util.HashMap<java.lang.String,java.lang.Object>> getMetricGroupTimeWindows(java.lang.String groupName,
                                                                                                             java.lang.String groupType,
                                                                                                             int twTypeId)
Retrieve a list of maps of time window metrics for the MetricGroup. The metrics are returned in a List, where each entry is a HashMap and the keys are the names of the metrics, e.g. numMessages, and the values are the time window value for that metric. A value is returned for each MetricType that is associated with the MetricGroupType of the MetricGroup. A value for the timestamp is also returned which indicates the start time of the time window for that list entry.

For a MetricGroup of type Service, the data returned in the List of HashMaps might look like this:-

 {timestamp=1322840325, exceptions=0, failures=0, numMessages=0, processingTimeMin=0, successes=0, twl=5, processingTimeMax=0, processingTimeAvg=0}
 {timestamp=1322840320, exceptions=0, failures=0, numMessages=0, processingTimeMin=0, successes=0, twl=5, processingTimeMax=0, processingTimeAvg=0}
 {timestamp=1322840315, exceptions=0, failures=0, numMessages=0, processingTimeMin=0, successes=0, twl=5, processingTimeMax=0, processingTimeAvg=0}
 {timestamp=1322840310, exceptions=0, failures=0, numMessages=5, processingTimeMin=567, successes=5, twl=5, processingTimeMax=600, processingTimeAvg=590}
 ..
 ..
 

Parameters:
groupName - The name of the MetricGroup.
groupType - The name of MetricGroupType of the MetricGroup.
twTypeId - The time window type, 0 for 5 secs, 1 for 5 mins, 2 for 1 hour
Returns:
The time window metrics

getMetricGroupTimeWindows

public static java.util.List<java.util.HashMap<java.lang.String,java.lang.Object>> getMetricGroupTimeWindows(long groupId,
                                                                                                             int twTypeId)
Retrieve a list of maps of time window metrics for the MetricGroup. The metrics are returned in a List, where each entry is a HashMap and the keys are the names of the metrics, e.g. numMessages, and the values are the time window value for that metric. A value is returned for each MetricType that is associated with the MetricGroupType of the MetricGroup. A value for the timestamp is also returned which indicates the start time of the time window for that list entry.

For a MetricGroup of type Service, the data returned in the List of HashMaps might look like this:-

 {timestamp=1322840325, exceptions=0, failures=0, numMessages=0, processingTimeMin=0, successes=0, twl=5, processingTimeMax=0, processingTimeAvg=0}
 {timestamp=1322840320, exceptions=0, failures=0, numMessages=0, processingTimeMin=0, successes=0, twl=5, processingTimeMax=0, processingTimeAvg=0}
 {timestamp=1322840315, exceptions=0, failures=0, numMessages=0, processingTimeMin=0, successes=0, twl=5, processingTimeMax=0, processingTimeAvg=0}
 {timestamp=1322840310, exceptions=0, failures=0, numMessages=5, processingTimeMin=567, successes=5, twl=5, processingTimeMax=600, processingTimeAvg=590}
 ..
 ..
 

Parameters:
metricGroupId - The id of the MetricGroup whose metrics to request.
twTypeId - The time window type, 0 for 5 secs, 1 for 5 mins, 2 for 1 hour
Returns:
The time window metrics

getEvents

public static java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> getEvents(java.lang.String type)
Retrieve a list of maps of events by type.

Parameters:
type - The type of events to retrieve. One of: log, alert, or sla
Returns:
The list of events

Vordel SDK


This documentation and all its contents and graphics, copyright © 1999 - 2011 Vordel